/** * Default constructor using the declaring type. The default lack the method * name specifics. * * @param type the type to extract default values for title, name and space. * @throws NullPointerException if {@code type} is <code>null</code>. */ public PropertyMetaDataDefaults(final Class<?> type) throws NullPointerException { this.space = createSpace(type); final PropertySet annotation = type.getAnnotation(PropertySet.class); this.title = annotation != null ? annotation.value() : type.getSimpleName(); this.name = this.title; }
/** * Default constructor using the method and adding the name of the method. * * @param propertyMethod the method to derive default values. */ public PropertyMetaDataDefaults(final Method propertyMethod) { final Class<?> type = propertyMethod.getDeclaringClass(); this.space = createSpace(type); this.title = determinePropertyTitle(type, propertyMethod); this.name = determinePropertyName(type, propertyMethod); }
/** * Default constructor using the declaring and method type. * * @param type the type to extract default values for title, name and space. * @param propertyMethod the method to check for a property set annotation * that overrides the one of the type. * @throws NullPointerException if {@code type} is <code>null</code>. */ public PropertyMetaDataDefaults(final Class<?> type, final Method propertyMethod) throws NullPointerException { this.space = createSpace(type); this.title = determineTitle(type, propertyMethod); this.name = determineName(type, propertyMethod); }
/** * Retruns the property set metadata defaults. * * @param propertyMethod the method of the property whose set defaults are * requested. * @return the defaults for the set referenced by the property identified by * the given method. */ public static PropertyMetaDataDefaults propertySet(final Method propertyMethod) { final Class<?> type = propertyMethod.getDeclaringClass(); final String space = createSpace(type); final PropertySet annotation = getPropertySetAnnotation(propertyMethod); final String title = annotation != null ? x(type, annotation) : type.getSimpleName(); final String name = title; final PropertyMetaDataDefaults defaults = new PropertyMetaDataDefaults(space, name, title); return defaults; }