private void addDocumentProxy(final Builder builder, final Method method, final PropertyKey key) { final DocumentMetaDataProxy proxy = new MetaInfDocumentMetaDataProxy(key, context, method); builder.with(proxy); }
private static void addSecured(final Builder builder, final Method method) { final boolean secured = readSecured(method); builder.setSecured(secured); }
private void addComments(final Builder builder) { final PropertyCommentProxy commentProxy = new PropertyCommentProxy(context); builder.with(commentProxy); }
/** * 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); }
@SuppressWarnings({ RAWTYPES, UNCHECKED }) private static void addValueRange(final Builder builder, final Method method) { final PropertyValueRange<?> valueRange = calculateValueRange(method); if (valueRange != null) { builder.with(valueRange); final PropertyRangeConstraint<?> constraint = new PropertyRangeConstraint(valueRange); builder.add(constraint); } }
/** * 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); }
/** * Reads the property key information from the method. * * @param method the method to read the property key. * @return the property key provided by this method. */ public PropertyKey readKey(final Method method) { final String set = readPropertySetName(method); final String name = readPropertyKeyName(method); return PropertyKey.create(set, name); }
private PropertyDescriptor readDescriptor(final PropertyReport report, final Class<?> type, final JavaMethod javaMethod, final PropertyMetaDataParser metaDataParser) { final String methodName = javaMethod.getName(); final Method method = getMethod(report, type, methodName); final PropertyDescriptor descriptor = metaDataParser.readDescriptor(method); return descriptor; }
private void addCategories(final Builder builder, final Method method) { final List<Class<?>> categories = readCategories(method); if (!categories.isEmpty()) { final PropertyCategories.Builder catBuilder = new PropertyCategories.Builder(); for (final Class<?> category : categories) { catBuilder.with(category); } final PropertyCategories propertyCategories = catBuilder.build(); builder.with(propertyCategories); } }
/** * Convenience constructor to generate property descriptors without comments. * * @return the created parser instance. */ public static PropertyMetaDataParser createWithoutContextAccess() { return new PropertyMetaDataParser(null); }
@Override public PropertyComment getComment(final Locale locale) { return commentProxy.getComment(this, locale); }
@Override public DocumentName getDocumentName() { return documentMetaDataProxy.getDocumentName(); }
@Override public PropertyProjectdoc getDocumentMetaData(final Locale locale) { return documentMetaDataProxy.getProjectdocProperty(this, locale); }
@Override public PropertySetProjectdoc getDocumentMetaDataProjectSet(final Locale locale) { return documentMetaDataProxy.getProjectdocPropertySet(this, locale); }
@Override public PropertyProjectdoc getDocumentMetaData() { return getDocumentMetaData(null); }
@Override public PropertySetProjectdoc getDocumentMetaDataProjectSet() { return getDocumentMetaDataProjectSet(null); }
@Override public PropertyComment getComment() { return getComment(null); }
private static PropertyType readType(final Method method) { final Class<?> type = method.getReturnType(); final Class<?> subType = determineSubType(method); return new PropertyType(type, subType); }
/** * 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; }
/** * Convenience constructor to generate property descriptors with access to * property comments. * * @param context the context to access comment information for properties. * @return the created parser instance. * @throws NullPointerException if {@code context} is <code>null</code>. */ public static PropertyMetaDataParser create(final PropertiesContext context) throws NullPointerException { Arg.checkNotNull("context", context); return new PropertyMetaDataParser(context); }