/** * 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; }
/** * 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); }
/** * 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); }
private static String determineTitle(final Class<?> type, final Method propertyMethod) { final Document document = determineDocumentTitleAnnotation(type, propertyMethod); final String title; if (document != null && document.title() != null) { title = document.title(); } else { final PropertySet annotation = determinePropertySetAnnotation(type, propertyMethod); title = annotation != null ? annotation.value() : type.getSimpleName(); } return title; }
AddReportItemHelper(final RuntimeUtils runtimeUtils, final JavaProjectBuilder javaProjectBuilder, final JavaClass propertyDescriptorType) throws ClassNotFoundException { this.runtimeUtils = runtimeUtils; this.javaProjectBuilder = javaProjectBuilder; this.propertyDescriptorType = propertyDescriptorType; this.propertySetJavaClass = runtimeUtils.loadClass(propertyDescriptorType); // TODO: Check if this is good enough since the defaults could be overridden // by a method level annotation of ProjectSet. final PropertyMetaDataDefaults parentDefaults = new PropertyMetaDataDefaults(propertySetJavaClass); this.projectdocCollector = new ProjectdocAnnotationCollector(propertySetJavaClass, parentDefaults, parentDefaults); }
private static String determinePropertyName(final Class<?> type, final Method propertyMethod) { final Document document = determineDocumentNameAnnotation(type, propertyMethod); final String prefix; if (document != null && document.name() != null) { prefix = document.name(); } else { final PropertySet annotation = determinePropertySetAnnotation(type, propertyMethod); prefix = annotation != null ? annotation.value() : null; } final String property = propertyMethod.getName(); final String name = StringUtils.isNotBlank(prefix) ? prefix + '.' + property : property; return name; }
/** * 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; }
private static String determinePropertyTitle(final Class<?> type, final Method propertyMethod) { final Document document = determineDocumentTitleAnnotation(type, propertyMethod); final String prefix; if (document != null && document.title() != null) { prefix = document.title(); } else { final PropertySet annotation = determinePropertySetAnnotation(type, propertyMethod); prefix = annotation != null ? annotation.value() : null; } final String property; final PropertyKeyName keyAnnotation = propertyMethod.getAnnotation(PropertyKeyName.class); if (keyAnnotation != null && keyAnnotation.value() != null) { property = keyAnnotation.value(); } else { property = propertyMethod.getName(); } final String title = prefix != null ? prefix + '.' + property : property; return title; }
new PropertyMetaDataDefaults(propertyMethod); final PropertyProjectdocParser parser = new PropertyProjectdocParser(context, defaults); new PropertyMetaDataDefaults(declaringType, propertyMethod); final Defaults defaults = new PropertyMetaDataDefaults(propertyMethod); final ProjectdocAnnotationCollector collector = new ProjectdocAnnotationCollector(declaringType, parentDefaults,
private static String determineName(final Class<?> type, final Method propertyMethod) { final Document document = determineDocumentNameAnnotation(type, propertyMethod); final String title; if (document != null && document.name() != null) { title = document.title(); } else { final PropertySet annotation = determinePropertySetAnnotation(type, propertyMethod); title = annotation != null ? annotation.value() : type.getSimpleName(); } return title; }