use of com.manydesigns.elements.reflection.MutablePropertyAccessor in project Portofino by ManyDesigns.
the class TablesAction method getApplicableAnnotations.
@NotNull
public MutableClassAccessor getApplicableAnnotations(Class type) {
MutableClassAccessor classAccessor = new MutableClassAccessor();
if (type == null) {
return classAccessor;
}
if (Number.class.isAssignableFrom(type)) {
classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
classAccessor.addProperty(new MutablePropertyAccessor("minValue", BigDecimal.class));
classAccessor.addProperty(new MutablePropertyAccessor("maxValue", BigDecimal.class));
classAccessor.addProperty(new MutablePropertyAccessor("decimalFormat", String.class));
} else if (String.class.equals(type)) {
classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
classAccessor.addProperty(new MutablePropertyAccessor("regexp", String.class));
classAccessor.addProperty(new MutablePropertyAccessor("highlightLinks", Boolean.class));
classAccessor.addProperty(new MutablePropertyAccessor("fileBlob", Boolean.class));
SelectImpl select = new SelectImpl(DisplayMode.DROPDOWN, SearchDisplayMode.DROPDOWN, new String[] { EMAIL, PASSWORD, CAP, PARTITA_IVA, CODICE_FISCALE, PHONE, ENCRYPTED }, new String[] { "Email", "Password", "CAP/ZIP", "Partita IVA", "Codice Fiscale", "Phone", "Encrypted" }, true);
classAccessor.addProperty(new MutablePropertyAccessor("stringFormat", String.class).configureAnnotation(select));
select = new SelectImpl(DisplayMode.DROPDOWN, SearchDisplayMode.DROPDOWN, new String[] { MULTILINE, RICH_TEXT }, new String[] { "Multiline", "Rich text" }, true);
classAccessor.addProperty(new MutablePropertyAccessor("typeOfContent", String.class).configureAnnotation(select));
} else if (Date.class.isAssignableFrom(type)) {
classAccessor.addProperty(new MutablePropertyAccessor("fieldSize", Integer.class));
classAccessor.addProperty(new MutablePropertyAccessor("dateFormat", String.class));
} else if (byte[].class.isAssignableFrom(type)) {
classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobContentTypeProperty", String.class));
classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobFileNameProperty", String.class));
classAccessor.addProperty(new MutablePropertyAccessor("databaseBlobTimestampProperty", String.class));
}
return classAccessor;
}
Aggregations