Skip to main content

Posts

Showing posts from July, 2016

COMPILATION ERROR : error: cannot find symbol en Maven

Entre algunos errores que podemos encontrar al crear un proyecto  maven COMPILATION ERROR :  error: cannot find symbol. Generalmente tenemos una clase en uno de los paquetes , y esta la importamos en otro paquete pero al compilar el proyecto se genera errores como este: Editamos el archivo pom.xml y agregamos     <build>         <plugins>             <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-compiler-plugin</artifactId>                 <version>3.1</version>                 <configuration>                     <source>1.7</source>                     <target>1.7</target>                 </configuration>             </plugin>         </plugins>     </build>

Un ejemplo sencillo de RefactorizaciĆ³n y Genericos

Un ejemplo sencillo de RefactorizaciĆ³n y Genericos public class Refactorizador<K, V> {     public V copyFromBeans(K k, V v) {         try {             Class claseK = k.getClass();             Class claseV = v.getClass();             Method[] metodosK = claseK.getMethods();             for (Method method : metodosK) {                 if (isGetter(method)) {                     Method metodoGetK = claseK.getDeclaredMethod(method.getName());                     Method metodoSetV = claseV.getDeclaredMethod(changeGetBySet(method.getName()), method.getReturnType());                     metodoSetV.invoke(v, metodoGetK.invoke(k));                 }             }         } catch (Exception e) {             System.out.println("refactorizador() " + e.getLocalizedMessage());         }         return v;     }          public  boolean isGetter(Method method) {         if (!method.getName().startsWith("get")) {             return false;         }         if (method.getNam