@Override public final void addPropertyChangeListener(final PropertyKey name, final PropertyChangeListener listener) throws NullPointerException { support.addPropertyChangeListener(name.toString(), listener); }
@Override public PropertyKey getKey() { return new PropertyKey("n/a"); }
/** * Creates an instance for the given qualified name. * <p> * The qualified name consists of two part that are separated by a 'at' ( * <code>@</code>) sign. The first part is the name of the property set, the * second part the name of the property. * </p> * {@example my-set@my.property.name} * <p> * The last 'at' sign is significant for the separation. That is, the property * set name may contain any number of 'at' signs. An 'at' sign at the end of * the qualified name is ignored. * </p> * * @param qualifiedName a name optionally prefixed with a property set name * separated by a 'at' (<code>@</code>) sign. * @return the created instance. */ public static PropertyKey create(final String qualifiedName) { return create(qualifiedName, '@'); }
/** * Returns the set of properties this property belongs to. * * @return the set of properties this property belongs to. */ public String getPropertySet() { final String descriptorValue = descriptor.getKey().getPropertySet(); if (StringUtils.isBlank(descriptorValue)) { return sourceInfo.getElementTypeName(); } return descriptorValue; }
/** * Returns the hash code of the object. * * @return the hash code. * @see de.smartics.properties.api.config.domain.PropertyDefinition#hashCode() */ @Override public int hashCode() { return descriptor.getKey().hashCode(); }
private static boolean isResolvementFailureOfPlaceholder( final PropertyValueResolveException e, final Property property) { return !property.getName().equals(e.getPropertyKey().getName()); }
/** * Returns <code>true</code> if the given object is semantically equal to the * given object, <code>false</code> otherwise. * <p> * It is assumed that a descriptor with its key is unique. Therefore two * definitions are equal, if their descriptor keys are equal, they share the * same value and source location of the value. * </p> * * @param object object the instance to compare to. * @return <code>true</code> if the given object is semantically equal to the * given object, <code>false</code> otherwise. */ @Override public boolean equals(final Object object) { if (this == object) { return true; } else if (object == null || getClass() != object.getClass()) { return false; } final PropertyDefinition other = (PropertyDefinition) object; return (descriptor.getKey().equals(other.descriptor.getKey()) && ObjectUtils.equals(property.getValue(), other.property.getValue()) && ObjectUtils.equals( property.getSource(), other.property.getSource())); }
final PropertyDescriptor descriptor, final Locale locale) final String target = descriptor.getKey().getPropertySet();
@Override public final void removePropertyChangeListener(final PropertyKey name, final PropertyChangeListener listener) throws NullPointerException { support.removePropertyChangeListener(name.toString(), listener); }
private static DocumentName calculateDocumentName(final PropertyKey key, final Method propertyMethod) { final Document annotation = propertyMethod.getAnnotation(Document.class); String name = propertyMethod.getName(); if (annotation != null) { final String value = annotation.name(); if (value != null) { final AnnotationHelper helper = new AnnotationHelper(); final String annName = helper.normalizeString(value); if (StringUtils.isNotBlank(annName)) // NOPMD { name = annName; } } } final String setName = key.getPropertySet(); final String fqn = setName != null ? setName + '.' + name : name; final DocumentName documentName = new DocumentName(fqn); return documentName; }
/** * Creates an instance for the given set and name. * * @param propertySet the name of the set the property belongs to. * @param name the name of the property. * @return the created instance. * @throws IllegalArgumentException if {@code propertySet} is blank but not * <code>null</code> or if {@code name} is blank. */ public static PropertyKey create(final String propertySet, final String name) throws IllegalArgumentException { return new PropertyKey(propertySet, name); }
/** * 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); }
@Override public final PropertyDescriptor getDescriptor(final PropertyKey key) throws UnknownPropertyException { return getDescriptor(key.toString()); }
/** * Creates an instance for the given qualified name. * * @param qualifiedName a name optionally prefixed with a property set name * separated by the last occurrence (excluding the very end) of the * {@code separator}. * @param separator the separator to use if for some reason the default is not * appropriate. * @return the created instance. * @throws BlankArgumentException if {@code qualifiedName} is blank. */ public static PropertyKey create(final String qualifiedName, final char separator) throws BlankArgumentException { Arg.checkNotBlank("qualifiedName", qualifiedName); final int dotIndex = qualifiedName.lastIndexOf(separator); if (dotIndex > 0 && dotIndex < qualifiedName.length() - 1) { final String propertySetName = qualifiedName.substring(0, dotIndex); final String name = qualifiedName.substring(dotIndex + 1); return new PropertyKey(propertySetName, name); } else { return new PropertyKey(null, qualifiedName); } }
private void checkValidPair(final PropertyDescriptor descriptor, final Property property) throws IllegalArgumentException { final String name = property.getName(); final String descriptorName = descriptor.getKey().toString(); if (!name.equals(descriptorName)) { throw new IllegalArgumentException("Property value with key '" + name + "' does not match the key '" + descriptorName + "' in the property descriptor."); } }
private static boolean isResolvementFailureOfPlaceholder( final PropertyValueResolveException e, final Property property) { return !property.getName().equals(e.getPropertyKey().toString()); }
@Override public final DescribedProperty getProperty(final PropertyKey key) throws IllegalArgumentException, UnknownPropertyException { final PropertyDescriptor descriptor = getPropertyDescriptor(key.toString()); return getProperty(descriptor); }
@Override public final ValidatedProperty getValidatedProperty(final PropertyKey key, final Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, PropertyValidationException { final PropertyDescriptor descriptor = getDescriptor(key.toString()); return getValidatedProperty(descriptor, defaultValue); }
@Override public final ValidatedProperty getValidatedProperty(final PropertyKey key, final Object defaultValue) throws IllegalArgumentException, UnknownPropertyException, PropertyValidationException, SecurityException { final PropertyDescriptor descriptor = getPropertyDescriptor(key.toString()); return getValidatedProperty(descriptor, defaultValue); }
@Override public final Object getPropertyValue(final PropertyKey key) throws IllegalArgumentException, UnknownPropertyException, PropertyValidationException { final PropertyDescriptor descriptor = getDescriptor(key.toString()); return getPropertyValue(descriptor); }