String addMethod = ADD_PROPERTY_TO_SETTER_MAP.get(propertyName); JType stringType = writer.getOracle().findType(String.class.getName()); if (ownerFieldClass.getRawType().findMethod(addMethod, new JType[]{stringType}) != null) { String n = attribute.getName(); String[] value = elem.consumeStringArrayAttribute(n);
public static JMethod getConcreteTypeMethod(JClassType serializer) { return serializer.findMethod("concreteType", new JType[0]); }
public static JMethod getConcreteTypeMethod(JClassType serializer) { return serializer.findMethod("concreteType", new JType[0]); }
private boolean isOverride(String methodName, JClassType superType) { JMethod method = superType.findMethod(methodName, NO_PARAMS); if (method != null && stringType.equals(method.getReturnType())) { return true; } return false; }
private boolean isOverride(String methodName, JClassType superType) { JMethod method = superType.findMethod(methodName, NO_PARAMS); if (method != null && stringType.equals(method.getReturnType())) { return true; } return false; }
private JMethod findRecursiveMethod(final JClassType pjclass, final String pasGetter, final JType[] pnoArgs) { if (pjclass == null || pasGetter == null) { return null; } final JMethod method = pjclass.findMethod(pasGetter, pnoArgs); if (method == null) { return findRecursiveMethod(pjclass.getSuperclass(), pasGetter, pnoArgs); } return method; }
private Annotation getAnnotation(PropertyDescriptor p, boolean useField, Class<? extends Annotation> expectedAnnotationClass) { Annotation annotation = null; if (useField) { JField field = beanType.findField(p.getPropertyName()); if (field.getEnclosingType().equals(beanType)) { annotation = field.getAnnotation(expectedAnnotationClass); } } else { JMethod method = beanType.findMethod(asGetter(p), NO_ARGS); if (method.getEnclosingType().equals(beanType)) { annotation = method.getAnnotation(expectedAnnotationClass); } } return annotation; }
private Annotation getAnnotation(final PropertyDescriptor ppropertyDescription, final boolean useField, final Class<? extends Annotation> expectedAnnotationClass) { Annotation annotation = null; if (useField) { final JField field = beanType.findField(ppropertyDescription.getPropertyName()); if (field.getEnclosingType().equals(beanType)) { annotation = field.getAnnotation(expectedAnnotationClass); } } else { final JMethod method = beanType.findMethod(asGetter(ppropertyDescription), NO_ARGS); if (method.getEnclosingType().equals(beanType)) { annotation = method.getAnnotation(expectedAnnotationClass); } } return annotation; }
private Annotation getAnnotation(PropertyDescriptor p, boolean useField, Class<? extends Annotation> expectedAnnotationClass) { Annotation annotation = null; if (useField) { JField field = beanType.findField(p.getPropertyName()); if (field.getEnclosingType().equals(beanType)) { annotation = field.getAnnotation(expectedAnnotationClass); } } else { JMethod method = beanType.findMethod(asGetter(p), NO_ARGS); if (method.getEnclosingType().equals(beanType)) { annotation = method.getAnnotation(expectedAnnotationClass); } } return annotation; }
JType getElementType(PropertyDescriptor p, boolean useField) { if (useField) { return jClass.findField(p.getPropertyName()).getType(); } else { return jClass.findMethod(GwtSpecificValidatorCreator.asGetter(p), GwtSpecificValidatorCreator.NO_ARGS).getReturnType(); } }
JType getElementType(PropertyDescriptor p, boolean useField) { if (useField) { return jClass.findField(p.getPropertyName()).getType(); } else { return jClass.findMethod(GwtSpecificValidatorCreator.asGetter(p), GwtSpecificValidatorCreator.NO_ARGS).getReturnType(); } }
private JClassType getMethodRoot(final JMethod method) { JClassType winner = method.getEnclosingType(); if (winner.isInterface() != null) { for (final JClassType type : winner.getImplementedInterfaces()) { if (type.findMethod(method.getName(), EMPTY_PARAMS) != null) { if (type.isAssignableFrom(winner)) { winner = type; } } } } return winner.getErasedType(); }
String methName = method.getName(); if (jsonBuilderType.findMethod(method.getName(), method.getParameterTypes()) != null || settingsType.findMethod(method.getName(), method.getParameterTypes()) != null) { continue;
public String generate(TreeLogger treeLogger, GeneratorContext generatorContext, String requestedClass) throws UnableToCompleteException { oracle = generatorContext.getTypeOracle(); JClassType clazz = oracle.findType(requestedClass); xmlBuilderType = oracle.findType(XmlBuilder.class.getName()); stringType = oracle.findType(String.class.getName()); String t[] = generateClassName(clazz); SourceWriter sw = getSourceWriter(treeLogger, generatorContext, t[0], t[1], requestedClass); if (sw != null) { for (JMethod method : clazz.getInheritableMethods()) { // skip method from JsonBuilder if (xmlBuilderType.findMethod(method.getName(), method.getParameterTypes()) != null) { continue; } generateMethod(sw, method, treeLogger); } sw.commit(treeLogger); } return t[2]; }
private boolean isPropertyConstrained(PropertyDescriptor p, boolean useField) { // cascaded counts as constrained // we must know if the @Valid annotation is on a field or a getter JClassType jClass = beanHelper.getJClass(); if (useField && jClass.findField(p.getPropertyName()).isAnnotationPresent(Valid.class)) { return true; } else if (!useField && jClass.findMethod(asGetter(p),NO_ARGS).isAnnotationPresent(Valid.class)) { return true; } // for non-cascaded properties for (ConstraintDescriptor<?> constraint : p.getConstraintDescriptors()) { org.hibernate.validator.metadata.ConstraintDescriptorImpl<?> constraintHibernate = (org.hibernate.validator.metadata.ConstraintDescriptorImpl<?>) constraint; if (constraintHibernate.getElementType() == (useField ? ElementType.FIELD : ElementType.METHOD)) { return true; } } return false; }
private boolean isPropertyConstrained(PropertyDescriptor p, boolean useField) { // cascaded counts as constrained // we must know if the @Valid annotation is on a field or a getter JClassType jClass = beanHelper.getJClass(); if (useField && jClass.findField(p.getPropertyName()).isAnnotationPresent(Valid.class)) { return true; } else if (!useField && jClass.findMethod(asGetter(p),NO_ARGS).isAnnotationPresent(Valid.class)) { return true; } // for non-cascaded properties for (ConstraintDescriptor<?> constraint : p.getConstraintDescriptors()) { org.hibernate.validator.metadata.ConstraintDescriptorImpl<?> constraintHibernate = (org.hibernate.validator.metadata.ConstraintDescriptorImpl<?>) constraint; if (constraintHibernate.getElementType() == (useField ? ElementType.FIELD : ElementType.METHOD)) { return true; } } return false; }
private boolean isPropertyConstrained(final PropertyDescriptor ppropertyDescription, final boolean useField) { // cascaded counts as constrained // we must know if the @Valid annotation is on a field or a getter final JClassType jClass = beanHelper.getJClass(); if (useField && jClass.findField(ppropertyDescription.getPropertyName()) .isAnnotationPresent(Valid.class)) { return true; } else if (!useField && jClass.findMethod(asGetter(ppropertyDescription), NO_ARGS) .isAnnotationPresent(Valid.class)) { return true; } // for non-cascaded properties for (final ConstraintDescriptor<?> constraint : ppropertyDescription .getConstraintDescriptors()) { final org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl<?> constraintHibernate = (org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl<?>) constraint; if (constraintHibernate .getElementType() == (useField ? ElementType.FIELD : ElementType.METHOD)) { return true; } } return false; }
} else { sw.print("object, "); final JMethod method = beanType.findMethod(asGetter(ppropertyDescription), NO_ARGS); if (method.isPublic()) { sw.print("object.");
} else { sw.print("object, "); JMethod method = beanType.findMethod(asGetter(p), NO_ARGS); if (method.isPublic()) { sw.print("object.");
} else { sw.print("object, "); JMethod method = beanType.findMethod(asGetter(p), NO_ARGS); if (method.isPublic()) { sw.print("object.");