PK F2; META-INF/PK E2;0>ffMETA-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 14.0-b16 (Sun Microsystems Inc.) PK E2;com/PK E2; com/aquait/PK E2;com/aquait/utils/PK E2;com/aquait/utils/gwt/PK E2;#com/aquait/utils/gwt/introspection/PK E2;com/aquait/utils/gwt/rebind/PK E2;=|G*com/aquait/utils/gwt/Introspection.gwt.xml PK E2;D7com/aquait/utils/gwt/introspection/Introspectable.class1 SourceFileIntrospectable.java1com/aquait/utils/gwt/introspection/Introspectablejava/lang/ObjectPK E2; &16com/aquait/utils/gwt/introspection/Introspectable.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.aquait.utils.gwt.introspection; /** * * @author quique */ public interface Introspectable { } PK E2; '6com/aquait/utils/gwt/introspection/Introspection.class1getIntrospectable5()Lcom/aquait/utils/gwt/introspection/Introspectable; Signature()TI;setIntrospectable6(Lcom/aquait/utils/gwt/introspection/Introspectable;)V(TI;)V getProperty&(Ljava/lang/String;)Ljava/lang/Object;-(Ljava/lang/String;)TT; setProperty'(Ljava/lang/String;Ljava/lang/Object;)VgetPropertyNames()Ljava/util/Collection;,()Ljava/util/Collection;JLjava/lang/Object; SourceFileIntrospection.java0com/aquait/utils/gwt/introspection/Introspectionjava/lang/Object    PK E2;>55com/aquait/utils/gwt/introspection/Introspection.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.aquait.utils.gwt.introspection; import java.util.Collection; /** * * @author quique */ public interface Introspection { I getIntrospectable(); void setIntrospectable(I i); T getProperty(String propName); void setProperty(String propName, Object value); Collection getPropertyNames(); } PK E2;7:com/aquait/utils/gwt/rebind/IntrospectionGenerator$1.class1   SourceFileIntrospectionGenerator.javaEnclosingMethod 4com/aquait/utils/gwt/rebind/IntrospectionGenerator$1 InnerClassesjava/lang/Object2com/aquait/utils/gwt/rebind/IntrospectionGenerator  PK E2;Y)EEKcom/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptor.class1'    "#nameLjava/lang/String;getter*Lcom/google/gwt/core/ext/typeinfo/JMethod;setterthis$04Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator;7(Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator;)VCodeLineNumberTableLocalVariableTablethisPropertyDescriptor InnerClassesGLcom/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptor;$m(Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator;Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator$1;)Vx0x16Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator$1; SourceFileIntrospectionGenerator.java  %&Ecom/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptorjava/lang/Object4com/aquait/utils/gwt/rebind/IntrospectionGenerator$1()V2com/aquait/utils/gwt/rebind/IntrospectionGenerator    4 *+*   D*+  !!PK E2;v""8com/aquait/utils/gwt/rebind/IntrospectionGenerator.class1_ a          `  + + O  + O     J L `  O     +       InnerClassesPropertyDescriptor()VCodeLineNumberTableLocalVariableTablethis4Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator;generatet(Lcom/google/gwt/core/ext/TreeLogger;Lcom/google/gwt/core/ext/GeneratorContext;Ljava/lang/String;)Ljava/lang/String;propertyDescriptorGLcom/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptor;i$Ljava/util/Iterator;jType(Lcom/google/gwt/core/ext/typeinfo/JType;jPrimitiveType1Lcom/google/gwt/core/ext/typeinfo/JPrimitiveType; getterSettersource)Lcom/google/gwt/user/rebind/SourceWriter;propertyDescriptorsLjava/util/List; classType-Lcom/google/gwt/core/ext/typeinfo/JClassType; packageNameLjava/lang/String; simpleNamesimpleNameIntospectioncomposer;Lcom/google/gwt/user/rebind/ClassSourceFileComposerFactory; printWriterLjava/io/PrintWriter;e4Lcom/google/gwt/core/ext/typeinfo/NotFoundException;logger$Lcom/google/gwt/core/ext/TreeLogger;context*Lcom/google/gwt/core/ext/GeneratorContext;typeNameLocalVariableTypeTableYLjava/util/List; ExceptionsfindProperties?(Lcom/google/gwt/core/ext/typeinfo/JClassType;)Ljava/util/List;pd setterMethod*Lcom/google/gwt/core/ext/typeinfo/JMethod; getterNamenIproperty getterMethodmethods; Signature(Lcom/google/gwt/core/ext/typeinfo/JClassType;)Ljava/util/List; getAllMethods@(Ljava/util/List;Lcom/google/gwt/core/ext/typeinfo/JClassType;)Vmarr$+[Lcom/google/gwt/core/ext/typeinfo/JMethod;len$mssuperClassTypel(Ljava/util/List;Lcom/google/gwt/core/ext/typeinfo/JClassType;)V SourceFileIntrospectionGenerator.java fg     ! java/lang/StringBuilder "# Introspection $ 9com/google/gwt/user/rebind/ClassSourceFileComposerFactory f%java.util.Collection &'java.util.ArrayList0com.aquait.utils.gwt.introspection.Introspection1com.aquait.utils.gwt.introspection.IntrospectableIntrospection<.> (' )* +,- .gprivate  introspectable; /' /gpublic void setIntrospectable( introspectable) {%this.introspectable = introspectable; 0g}public  getIntrospectable() {return introspectable; ,public Object getProperty(String property) {1 234 56 78Ecom/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptorif (property.equals(" 9")) {return introspectable. :();} else ;'{-throw new IllegalArgumentException(property);8public void setProperty(String property, Object value) { < =>? @A BCintrospectable.((D E )value); F 0private Collection propertyNames = null;.public Collection getPropertyNames() {if (propertyNames == null) {(propertyNames = new ArrayList();propertyNames.add("");return propertyNames; GH I 2com/google/gwt/core/ext/typeinfo/NotFoundException Jgjava/util/ArrayList (com/google/gwt/core/ext/typeinfo/JMethodgetK LMis N@ OvP QR STset fU VW X SY ZR [\ ]^2com/aquait/utils/gwt/rebind/IntrospectionGenerator!com/google/gwt/core/ext/Generator4com/aquait/utils/gwt/rebind/IntrospectionGenerator$11com/google/gwt/core/ext/UnableToCompleteException(com/google/gwt/core/ext/GeneratorContext getTypeOracle/()Lcom/google/gwt/core/ext/typeinfo/TypeOracle;+com/google/gwt/core/ext/typeinfo/TypeOraclegetTypeA(Ljava/lang/String;)Lcom/google/gwt/core/ext/typeinfo/JClassType;+com/google/gwt/core/ext/typeinfo/JClassType getPackage-()Lcom/google/gwt/core/ext/typeinfo/JPackage;)com/google/gwt/core/ext/typeinfo/JPackagegetName()Ljava/lang/String;getSimpleSourceNameappend-(Ljava/lang/String;)Ljava/lang/StringBuilder;toString'(Ljava/lang/String;Ljava/lang/String;)V addImport(Ljava/lang/String;)VaddImplementedInterface tryCreate_(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Ljava/lang/String;)Ljava/io/PrintWriter;createSourceWriterj(Lcom/google/gwt/core/ext/GeneratorContext;Ljava/io/PrintWriter;)Lcom/google/gwt/user/rebind/SourceWriter;'com/google/gwt/user/rebind/SourceWriterindentprintlnoutdentjava/util/Listiterator()Ljava/util/Iterator;java/util/IteratorhasNext()Znext()Ljava/lang/Object;namegetterprintsetter getParameters0()[Lcom/google/gwt/core/ext/typeinfo/JParameter;+com/google/gwt/core/ext/typeinfo/JParameter*()Lcom/google/gwt/core/ext/typeinfo/JType;&com/google/gwt/core/ext/typeinfo/JType isPrimitive3()Lcom/google/gwt/core/ext/typeinfo/JPrimitiveType;/com/google/gwt/core/ext/typeinfo/JPrimitiveTypegetQualifiedBoxedSourceNamegetQualifiedSourceNamecommit'(Lcom/google/gwt/core/ext/TreeLogger;)V#getParameterizedQualifiedSourceNameprintStackTracejava/lang/String startsWith(Ljava/lang/String;)Z getReturnTypeBOOLEANjava/lang/Objectequals(Ljava/lang/Object;)Z substring(I)Ljava/lang/String;m(Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator;Lcom/aquait/utils/gwt/rebind/IntrospectionGenerator$1;)Vlength()I toLowerCase(II)Ljava/lang/String;add getMethods-()[Lcom/google/gwt/core/ext/typeinfo/JMethod; getSuperclass/()Lcom/google/gwt/core/ext/typeinfo/JClassType;!`afgh3*i j klmnhi,-:::Y  : Y :Y     ,+:  , :   Y       Y         ! "  Y#    $   % ! " *&:  '  (:  )y *+:  Y,  - .   Y/  01 2   ! 34 5  6 ! " ! "  7  (:  ) *+:  Y,  - .   892::;:9 Y<  81 = > ? A Y<  81 =  892:@ ?  ! 34! 5  6 ! " ! "  A B  C  D (:  )5 *+:  YE  - F  " ! G ! "  +HYI  :K_`JiZV' )*+6-C/J0Q1X2_4689:;<=> ?@A%B,CVD]EfFmGvH}IJKLMNOP QRT'U.V7W>XGYNZW[^\g]n^_`abcdfFhMiVjYkblimrnyopqrstuvwxyz|} ~)09@H`bgjgop qr stuvwp wqr #wp <qr xy z{ T|}J~C6*C bikliii z h: :LYMMLYMN*-+N-(:)*O:1PQ*1RQS;TU91:1RQ6V:-(:  ) *O:  1WQ~ 1VXm 9c+Y*Y: Z [-( Y\[ V - 0  8, ]Wb,iR4ho&/58jz Up qr o4qr:kl:|}2z{*{2z*h@,^N-:662:+]W,_: *+Ni"'-38?j\  % q@kl@{@|};3 } @db`+`ePK E2;!!7com/aquait/utils/gwt/rebind/IntrospectionGenerator.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.aquait.utils.gwt.rebind; import com.google.gwt.core.ext.Generator; import com.google.gwt.core.ext.UnableToCompleteException; import java.io.PrintWriter; import com.google.gwt.core.ext.GeneratorContext; import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JPrimitiveType; import com.google.gwt.core.ext.typeinfo.JType; import com.google.gwt.core.ext.typeinfo.NotFoundException; import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; import com.google.gwt.user.rebind.SourceWriter; import java.util.ArrayList; import java.util.List; /** * * @author quique */ public class IntrospectionGenerator extends Generator { private class PropertyDescriptor { String name; JMethod getter; JMethod setter; } @Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { try { JClassType classType = context.getTypeOracle().getType(typeName); String packageName = classType.getPackage().getName(); String simpleName = classType.getSimpleSourceName(); String simpleNameIntospection = classType.getSimpleSourceName() + "Introspection"; ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleNameIntospection); composer.addImport("java.util.Collection"); composer.addImport("java.util.ArrayList"); composer.addImport("com.aquait.utils.gwt.introspection.Introspection"); composer.addImport("com.aquait.utils.gwt.introspection.Introspectable"); composer.addImplementedInterface("Introspection<" + packageName + "." + simpleName + ">"); PrintWriter printWriter = context.tryCreate(logger, packageName, simpleNameIntospection); if (printWriter != null) { SourceWriter source = composer.createSourceWriter(context, printWriter); source.indent(); source.println("private " + packageName + "." + simpleName + " introspectable;"); source.println(); source.println("public void setIntrospectable(" + packageName + "." + simpleName + " introspectable) {"); source.indent(); source.println("this.introspectable = introspectable;"); source.outdent(); source.println("}"); source.println(); source.println("public " + packageName + "." + simpleName + " getIntrospectable() {"); source.indent(); source.println("return introspectable;"); source.outdent(); source.println("}"); source.println(); List propertyDescriptors = findProperties(classType); source.println("public Object getProperty(String property) {"); source.indent(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { source.println("if (property.equals(\"" + propertyDescriptor.name + "\")) {"); source.indent(); source.println("return introspectable." + propertyDescriptor.getter.getName() + "();"); source.println(); source.outdent(); source.print("} else "); } source.println("{"); source.indent(); source.println("throw new IllegalArgumentException(property);"); source.outdent(); source.println("}"); source.outdent(); source.println("}"); source.println(); source.println("public void setProperty(String property, Object value) {"); source.indent(); for (PropertyDescriptor getterSetter : propertyDescriptors) { source.println("if (property.equals(\"" + getterSetter.name + "\")) {"); source.indent(); JType jType = getterSetter.setter.getParameters()[0].getType(); JPrimitiveType jPrimitiveType = jType.isPrimitive(); if (jPrimitiveType != null) { source.println("introspectable." + getterSetter.setter.getName() + "((" + jPrimitiveType.getQualifiedBoxedSourceName() + ")value);"); } else { source.println("introspectable." + getterSetter.setter.getName() + "((" + getterSetter.setter.getParameters()[0].getType().getQualifiedSourceName() + ")value);"); } source.outdent(); source.print("} else "); } source.println("{"); source.indent(); source.println("throw new IllegalArgumentException(property);"); source.outdent(); source.println("}"); source.outdent(); source.println("}"); source.println(); source.println("private Collection propertyNames = null;"); source.println("public Collection getPropertyNames() {"); source.indent(); source.println("if (propertyNames == null) {"); source.indent(); source.println("propertyNames = new ArrayList();"); for (PropertyDescriptor getterSetter : propertyDescriptors) { source.println("propertyNames.add(\"" + getterSetter.name + "\");"); } source.println("}"); source.outdent(); source.println("return propertyNames;"); source.outdent(); source.println("}"); source.println(); source.commit(logger); } return classType.getParameterizedQualifiedSourceName() + "Introspection"; } catch (NotFoundException e) { e.printStackTrace(); return null; } } private List findProperties(JClassType classType) { List propertyDescriptors = new ArrayList(); List methods = new ArrayList(); getAllMethods(methods, classType); // busco entre todos los métodos los que sean getXxx() o isXxx() for (JMethod getterMethod : methods) { if (getterMethod.getName().startsWith("get") || (getterMethod.getName().startsWith("is") && getterMethod.getReturnType().isPrimitive().equals(JPrimitiveType.BOOLEAN)) && getterMethod.getParameters().length == 0) { String getterName = getterMethod.getName(); int n = getterMethod.getName().startsWith("is") ? 2 : 3; String property = getterName.substring(n); for (JMethod setterMethod : methods) { if (setterMethod.getName().startsWith("set") && property.equals(setterMethod.getName().substring(3)) && setterMethod.getParameters().length == 1) { // encontré getXxx() (o isXxx()) y setXxx(val) => agrego xxx a la lista properties PropertyDescriptor pd = new PropertyDescriptor(); if (property.length() == 1) { pd.name = property.toLowerCase(); } else { // (property.length() > 1) pd.name = property.substring(0, 1).toLowerCase() + property.substring(1); } pd.getter = getterMethod; pd.setter = setterMethod; propertyDescriptors.add(pd); break; } } } } return propertyDescriptors; } private void getAllMethods(List methods, JClassType classType) { JMethod[] ms = classType.getMethods(); for (JMethod m : ms) { methods.add(m); } JClassType superClassType = classType.getSuperclass(); if (superClassType != null) { getAllMethods(methods, superClassType); } } } PK F2; AMETA-INF/PK E2;0>ff+META-INF/MANIFEST.MFPK E2;Acom/PK E2; Acom/aquait/PK E2;Acom/aquait/utils/PK E2;A=com/aquait/utils/gwt/PK E2;#Apcom/aquait/utils/gwt/introspection/PK E2;Acom/aquait/utils/gwt/rebind/PK E2;=|G*com/aquait/utils/gwt/Introspection.gwt.xmlPK E2;D7Pcom/aquait/utils/gwt/introspection/Introspectable.classPK E2; &165com/aquait/utils/gwt/introspection/Introspectable.javaPK E2; '6]com/aquait/utils/gwt/introspection/Introspection.classPK E2;>55com/aquait/utils/gwt/introspection/Introspection.javaPK E2;7: com/aquait/utils/gwt/rebind/IntrospectionGenerator$1.classPK E2;Y)EEK com/aquait/utils/gwt/rebind/IntrospectionGenerator$PropertyDescriptor.classPK E2;v""8com/aquait/utils/gwt/rebind/IntrospectionGenerator.classPK E2;!!73com/aquait/utils/gwt/rebind/IntrospectionGenerator.javaPKSU