/** * Returns a property or null if it cannot be found. * * @param propertyName the name of the property * @param type the property type * @param <T> the property parameter type * @return the property object * @throws NullPointerException if any argument is null */ private <T> Property<T> getProperty(String propertyName, Class<T> type) throws NullPointerException { if (propertyName == null) { throw new NullPointerException("No null property name accepted"); } if (type == null) { throw new NullPointerException("No null property type accepted"); } Property<?> property = properties.get(propertyName); if (property != null) { PropertyDescriptor<?> descriptor = property.getDescriptor(); if (type.equals(descriptor.getType())) { return (Property<T>)property; } } return null; }
/** * Returns a property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property object * @throws NullPointerException if the descriptor argument is null */ public <T> Property<T> getProperty(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } return getProperty(desc.getName(), desc.getType()); }
/** * Returns a property value or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getPropertyValue(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } Property<T> property = getProperty(desc.getName(), desc.getType()); return property != null ? property.getValue() : null; }
/** * Returns a property or null if it cannot be found. * * @param propertyName the name of the property * @param type the property type * @param <T> the property parameter type * @return the property object * @throws NullPointerException if any argument is null */ private <T> Property<T> getProperty(String propertyName, Class<T> type) throws NullPointerException { if (propertyName == null) { throw new NullPointerException("No null property name accepted"); } if (type == null) { throw new NullPointerException("No null property type accepted"); } Property<?> property = properties.get(propertyName); if (property != null) { PropertyDescriptor<?> descriptor = property.getDescriptor(); if (type.equals(descriptor.getType())) { return (Property<T>)property; } } return null; }
/** * Returns a context property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } return getProperty(desc.getName(), desc.getType()); }
/** * Returns a property or null if it cannot be found. * * @param propertyName the name of the property * @param type the property type * @param <T> the property parameter type * @return the property object * @throws NullPointerException if any argument is null */ private <T> Property<T> getProperty(String propertyName, Class<T> type) throws NullPointerException { if (propertyName == null) { throw new NullPointerException("No null property name accepted"); } if (type == null) { throw new NullPointerException("No null property type accepted"); } Property<?> property = properties.get(propertyName); if (property != null) { PropertyDescriptor<?> descriptor = property.getDescriptor(); if (type.equals(descriptor.getType())) { return (Property<T>)property; } } return null; }
/** * Returns a property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property object * @throws NullPointerException if the descriptor argument is null */ public <T> Property<T> getProperty(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } return getProperty(desc.getName(), desc.getType()); }
/** * Returns a property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property object * @throws NullPointerException if the descriptor argument is null */ public <T> Property<T> getProperty(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } return getProperty(desc.getName(), desc.getType()); }
/** * Returns a context property or null if it cannot be found. * * @param propertyName the name of the property * @param type the property type * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ <T> T getProperty(String propertyName, Class<T> type) throws NullPointerException { if (propertyName == null) { throw new NullPointerException("No null property name accepted"); } if (type == null) { throw new NullPointerException("No null property type accepted"); } Property<?> property = properties.get(propertyName); if (property != null) { PropertyDescriptor<?> descriptor = property.getDescriptor(); if (descriptor.getType().isAssignableFrom(type)) { return type.cast(property.getValue()); } } return null; }
/** * Returns a property value or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getPropertyValue(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } Property<T> property = getProperty(desc.getName(), desc.getType()); return property != null ? property.getValue() : null; }
/** * Returns a property value or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getPropertyValue(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } Property<T> property = getProperty(desc.getName(), desc.getType()); return property != null ? property.getValue() : null; }