Java Code Examples for com.google.gwt.core.ext.typeinfo.JField#getAnnotation()
The following examples show how to use
com.google.gwt.core.ext.typeinfo.JField#getAnnotation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitializeFormCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public InitializeFormCreator(JField modelField) { this.modelField = modelField; this.fieldType = modelField.getType(); Initialize initializeAnnotation = modelField.getAnnotation(Initialize.class); this.constantClassName = initializeAnnotation.constantsClass(); if (ConstantsWithLookup.class.equals(this.constantClassName)) { this.constantClassName = null; } if (this.fieldType instanceof JParameterizedType) { JParameterizedType paramType = (JParameterizedType) this.fieldType; this.beanType = paramType.getTypeArgs()[0]; } else { throw new RuntimeException("modelField can not be injected as Model"); } }
Example 2
Source File: InjectCreatorUtil.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public static Collection<JField> listFields(JClassType type, Class<? extends Annotation> annotationClass) { Collection<JField> methodAnnoted = Lists.newArrayList(); JField[] fields = type.getFields(); for (JField field : fields) { Annotation annotation = field.getAnnotation(annotationClass); if (annotation != null) { methodAnnoted.add(field); } } // Recurse to superclass JClassType superclass = type.getSuperclass(); if (superclass != null) { methodAnnoted.addAll(InjectCreatorUtil.listFields(superclass, annotationClass)); } return methodAnnoted; }
Example 3
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void appendSizeValidator(SourceWriter w, JField field) { Size sizeAnnotation = field.getAnnotation(Size.class); if (sizeAnnotation != null) { w.println(", new SizeValidator(\"%s\", %s, %s)", sizeAnnotation.message(), sizeAnnotation.min(), sizeAnnotation.max()); } }
Example 4
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void appendPatternValidator(SourceWriter w, JField field) { Pattern patternAnnotation = field.getAnnotation(Pattern.class); if (patternAnnotation != null) { w.println(", new PatternValidator(\"%s\", \"%s\")", patternAnnotation.message(), patternAnnotation.regexp() .replace("\\", "\\\\"), patternAnnotation.flags()); } }
Example 5
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendPastValidator(SourceWriter w, JField field) { Past pastAnnotation = field.getAnnotation(Past.class); if (pastAnnotation != null) { w.println(", new PastValidator(\"%s\")", pastAnnotation.message()); } }
Example 6
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendNullValidator(SourceWriter w, JField field) { Null nullAnnotation = field.getAnnotation(Null.class); if (nullAnnotation != null) { w.println(", new NullValidator(\"%s\")", nullAnnotation.message()); } }
Example 7
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendNotNullValidator(SourceWriter w, JField field) { NotNull notNullAnnotation = field.getAnnotation(NotNull.class); if (notNullAnnotation != null) { w.println(", new NotNullValidator(\"%s\")", notNullAnnotation.message()); } }
Example 8
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendMinValidator(SourceWriter w, JField field) { Min minAnnotation = field.getAnnotation(Min.class); if (minAnnotation != null) { w.println(", new MinValidator(\"%s\", %s)", minAnnotation.message(), minAnnotation.value()); } }
Example 9
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendMaxValidator(SourceWriter w, JField field) { Max maxAnnotation = field.getAnnotation(Max.class); if (maxAnnotation != null) { w.println(", new MaxValidator(\"%s\", %s)", maxAnnotation.message(), maxAnnotation.value()); } }
Example 10
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendFutureValidator(SourceWriter w, JField field) { Future futureAnnotation = field.getAnnotation(Future.class); if (futureAnnotation != null) { w.println(", new FutureValidator(\"%s\")", futureAnnotation.message()); } }
Example 11
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendFalseValidator(SourceWriter w, JField field) { AssertFalse falseAnnotation = field.getAnnotation(AssertFalse.class); if (falseAnnotation != null) { w.println(", new AssertFalseValidator(\"%s\")", falseAnnotation.message()); } }
Example 12
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void appendTrueValidator(SourceWriter w, JField field) { AssertTrue trueAnnotation = field.getAnnotation(AssertTrue.class); if (trueAnnotation != null) { w.println(", new AssertTrueValidator(\"%s\")", trueAnnotation.message()); } }