Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/11/2012, 14:50
LuisChavezB
 
Fecha de Ingreso: diciembre-2011
Mensajes: 152
Antigüedad: 12 años, 11 meses
Puntos: 34
Respuesta: Evaluar si .java de un directorio forman parte d el proyecto y acceder a m

Puedes utilizar anotaciones:
Código Javascript:
Ver original
  1. /*
  2.  * Copyright 2012 Leviathan.
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package mx.com.leviathan.data.filter;
  17.  
  18. import java.lang.annotation.ElementType;
  19. import java.lang.annotation.Retention;
  20. import java.lang.annotation.RetentionPolicy;
  21. import java.lang.annotation.Target;
  22.  
  23. /**
  24.  *
  25.  * @author Leviathan
  26.  */
  27. @Target(ElementType.TYPE)
  28. @Retention(RetentionPolicy.RUNTIME)
  29. public @interface Filter {
  30.  
  31.     String author();
  32.  
  33.     String name();
  34.  
  35.     String version();
  36. }

Código Javascript:
Ver original
  1. /*
  2.  * Copyright 2012 Leviathan.
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package mx.com.leviathan.data.filter;
  17.  
  18. import java.lang.annotation.ElementType;
  19. import java.lang.annotation.Retention;
  20. import java.lang.annotation.RetentionPolicy;
  21. import java.lang.annotation.Target;
  22.  
  23. /**
  24.  *
  25.  * @author Leviathan
  26.  */
  27. @Target(ElementType.METHOD)
  28. @Retention(RetentionPolicy.RUNTIME)
  29. public @interface FilterFunction {
  30.  
  31.     String[] params();
  32.  
  33.     Class<?>[] paramTypes();
  34.  
  35.     Class<?> returnType();
  36. }

Aplicarlas:
Código Javascript:
Ver original
  1. @Filter(author = "Leviathan", version = "0.1", name = "Example")
  2. public class FilterExample {
  3.  
  4.     @FilterFunction(params = {"firstName", "lastName"}, paramTypes = {String.class, String.class}, returnType = String.class)
  5.     public String testString(String firstName, String lastName) {
  6.         return firstName + lastName;
  7.     }
  8. }

y por medio de reflexión trabajar con la información proporcionada en las anotaciones.