use of com.manydesigns.elements.reflection.ClassAccessor in project Portofino by ManyDesigns.
the class JodaTimeFieldTest method setupFields.
private void setupFields(Mode mode) throws NoSuchFieldException {
ClassAccessor classAccessor = JavaClassAccessor.getClassAccessor(this.getClass());
PropertyAccessor myPropertyAccessor = classAccessor.getProperty("date");
dateField = new JodaTimeField(myPropertyAccessor, mode, null);
}
use of com.manydesigns.elements.reflection.ClassAccessor in project Portofino by ManyDesigns.
the class AbstractResourceAction method getConfiguration.
/**
* Returns the configuration of this action, filtered using permissions.
* @return the configuration.
*/
@io.swagger.v3.oas.annotations.Operation(operationId = "com.manydesigns.portofino.resourceactions.AbstractResourceAction#getConfiguration", description = "Returns the configuration of this action. " + "The actual type of the configuration object depends on the action class.")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "The configuration object.") })
@Path(":configuration")
@GET
@Produces(MimeTypes.APPLICATION_JSON_UTF8)
public Object getConfiguration() {
Object configuration = actionInstance.getConfiguration();
if (getConfigurationClass() == null) {
return configuration;
}
ClassAccessor classAccessor = getConfigurationClassAccessor();
ClassAccessor filteredClassAccessor = filterAccordingToPermissions(classAccessor);
ResourceActionConfiguration filtered = (ResourceActionConfiguration) classAccessor.newInstance();
for (PropertyAccessor propertyAccessor : filteredClassAccessor.getProperties()) {
if (propertyAccessor.isWritable()) {
propertyAccessor.set(filtered, propertyAccessor.get(configuration));
}
}
filtered.init();
return filtered;
}
use of com.manydesigns.elements.reflection.ClassAccessor in project Portofino by ManyDesigns.
the class SelectFieldTest method setupSelectFields.
private void setupSelectFields(Mode mode) {
ClassAccessor classAccessor = JavaClassAccessor.getClassAccessor(this.getClass());
PropertyAccessor myPropertyAccessor = null;
try {
myPropertyAccessor = classAccessor.getProperty("myText");
} catch (NoSuchFieldException e) {
fail(e.getMessage(), e);
}
// impostiamo selectField1
selectField = new SelectField(myPropertyAccessor, mode, null);
selectField.setSelectionModel(selectionModel);
// impostiamo selectField2
selectField2 = new SelectField(myPropertyAccessor, mode, null);
selectField2.setSelectionModel(selectionModel2);
// impostiamo selectField3
selectField3 = new SelectField(myPropertyAccessor, mode, null);
selectField3.setSelectionModel(selectionModel3);
}
use of com.manydesigns.elements.reflection.ClassAccessor in project Portofino by ManyDesigns.
the class DefaultLoginAction method describeNewUserClassAccessor.
@Path("user/classAccessor")
@GET
@Produces(MimeTypes.APPLICATION_JSON_UTF8)
@Operation(summary = "The class accessor that describes the registration of a new user")
public String describeNewUserClassAccessor() {
ClassAccessor classAccessor = getNewUserClassAccessor();
JSONStringer jsonStringer = new JSONStringer();
ReflectionUtil.classAccessorToJson(classAccessor, jsonStringer);
return jsonStringer.toString();
}
use of com.manydesigns.elements.reflection.ClassAccessor in project Portofino by ManyDesigns.
the class AbstractResourceAction method getConfigurationAccessor.
@io.swagger.v3.oas.annotations.Operation(operationId = "com.manydesigns.portofino.resourceactions.AbstractResourceAction#getConfigurationAccessor", description = "A ClassAccessor that describes the configuration of this action.")
@GET
@Path(":configuration/classAccessor")
@Produces(MimeTypes.APPLICATION_JSON_UTF8)
public String getConfigurationAccessor() {
ClassAccessor classAccessor = getConfigurationClassAccessor();
if (classAccessor == null) {
return null;
}
JSONStringer jsonStringer = new JSONStringer();
ReflectionUtil.classAccessorToJson(classAccessor, jsonStringer);
return jsonStringer.toString();
}
Aggregations