Skip to content

Instantly share code, notes, and snippets.

@marti1125
Last active December 14, 2015 01:48
Show Gist options
  • Save marti1125/5008726 to your computer and use it in GitHub Desktop.
Save marti1125/5008726 to your computer and use it in GitHub Desktop.
Create a Anotation custom for CRUD in Play Framework 1.2.5
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