Last active
December 14, 2015 01:48
-
-
Save marti1125/5008726 to your computer and use it in GitHub Desktop.
Create a Anotation custom for CRUD in Play Framework 1.2.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRUD.class | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.FIELD) | |
public @interface HideInForm { | |
} | |
public List<ObjectField> getFields() { | |
List<ObjectField> fields = new ArrayList<ObjectField>(); | |
List<ObjectField> hiddenFields = new ArrayList<ObjectField>(); | |
for (Model.Property f : factory.listProperties()) { | |
ObjectField of = new ObjectField(f); | |
if (of.type != null) { | |
if (!f.field.isAnnotationPresent(HideInForm.class)) { | |
if (of.type.equals("hidden")) { | |
hiddenFields.add(of); | |
} else { | |
fields.add(of); | |
} | |
} | |
} | |
} | |
hiddenFields.addAll(fields); | |
return hiddenFields; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment