private Property modelFor(final ObjectSpecification specification) { if (specification == null) { return new ObjectProperty(); } // no "simple" representation for void or values final Class<?> correspondingClass = specification.getCorrespondingClass(); if (correspondingClass == void.class || correspondingClass == Void.class) { return new ObjectProperty(); } // no "simple" representation for values final Property property = valuePropertyFactory.newProperty(correspondingClass); if (property != null) { // was recognized as a value return new ObjectProperty(); } if (specification.isParentedOrFreeCollection()) { TypeOfFacet typeOfFacet = specification.getFacet(TypeOfFacet.class); if (typeOfFacet != null) { ObjectSpecification elementSpec = typeOfFacet.valueSpec(); if (elementSpec != null) { return arrayPropertyOf(elementSpec); } } } if (specification.getCorrespondingClass() == java.lang.Object.class) { return new ObjectProperty(); } if (specification.getCorrespondingClass() == java.lang.Enum.class) { return new StringProperty(); } return newRefProperty(objectTypeFor(specification) + "Repr"); }
Property propertyFor(final ObjectSpecification objectSpecification) { final Property property = valuePropertyFactory.newProperty(objectSpecification.getCorrespondingClass()); if (property != null) { return property; } else { // assume this is a reference to an entity/view model, meaning we use an href return refToHrefModel(); } }