org.modeshape.graph.property.basic
Class SystemPropertyFactory

java.lang.Object
  extended by org.modeshape.graph.property.basic.BasicPropertyFactory
      extended by org.modeshape.graph.property.basic.SystemPropertyFactory
All Implemented Interfaces:
PropertyFactory

@Immutable
public class SystemPropertyFactory
extends BasicPropertyFactory

An implementation of PropertyFactory which provides the feature for substituting special decorated variables (i.e., ${variable}) with a system property. This will support the following decorated syntax options:

  • ${variable}
  • ${variable [,variable,..] }
  • ${variable [:defaultvalue] }
  • Where the variable represents a value to be looked up in the System properties and defaultvalue indicates what to use when the System property is not found.

    Notice that the syntax supports multiple variables. The logic will process the variables from let to right, until a System property is found. And at that point, it will stop and will not attempt to find values for the other variables.


    Constructor Summary
    SystemPropertyFactory(ValueFactories valueFactories)
               
     
    Method Summary
     Property create(Name name, PropertyType desiredType, Iterable<?> values)
              Create a property with the supplied name and values
     Property create(Name name, PropertyType desiredType, Iterator<?> values)
              Create a property with the supplied name and values
     Property create(Name name, PropertyType desiredType, Object... values)
              Create a property with the supplied name and values
    protected  String getSubstitutedProperty(String value)
              getSubstitutedProperty is called to perform the property substitution on the value.
     
    Methods inherited from class org.modeshape.graph.property.basic.BasicPropertyFactory
    create, create, create, create
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SystemPropertyFactory

    public SystemPropertyFactory(ValueFactories valueFactories)
    Parameters:
    valueFactories - the value factories
    Throws:
    IllegalArgumentException - if the reference to the value factories is null
    Method Detail

    create

    public Property create(Name name,
                           PropertyType desiredType,
                           Object... values)
    Create a property with the supplied name and values

    Specified by:
    create in interface PropertyFactory
    Overrides:
    create in class BasicPropertyFactory
    Parameters:
    name - the property name; may not be null
    desiredType - the type that the objects should be converted to; if null, they will be used as is
    values - the values
    Returns:
    the resulting property

    create

    public Property create(Name name,
                           PropertyType desiredType,
                           Iterable<?> values)
    Create a property with the supplied name and values

    Specified by:
    create in interface PropertyFactory
    Overrides:
    create in class BasicPropertyFactory
    Parameters:
    name - the property name; may not be null
    desiredType - the type that the objects should be converted to; if null, they will be used as is
    values - the values
    Returns:
    the resulting property

    create

    public Property create(Name name,
                           PropertyType desiredType,
                           Iterator<?> values)
    Create a property with the supplied name and values

    Specified by:
    create in interface PropertyFactory
    Overrides:
    create in class BasicPropertyFactory
    Parameters:
    name - the property name; may not be null
    desiredType - the type that the objects should be converted to; if null, they will be used as is
    values - the values
    Returns:
    the resulting property

    getSubstitutedProperty

    protected String getSubstitutedProperty(String value)
    getSubstitutedProperty is called to perform the property substitution on the value.

    Parameters:
    value -
    Returns:
    String


    Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.