jfun.yan.xml.nuts
Class ArgumentsAndPropertiesNut

java.lang.Object
  extended by jfun.yan.xml.nut.Nut
      extended by jfun.yan.xml.nut.ComponentNut
          extended by jfun.yan.xml.nuts.ArgumentsAndPropertiesNut
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ConstructorNut, MethodNut

public abstract class ArgumentsAndPropertiesNut
extends ComponentNut

Super class for any Nut that supports <arg>, <args>,<prop> and <props> sub-elements.

Author:
Ben Yu Nov 9, 2005 11:38:43 PM
See Also:
Serialized Form

Constructor Summary
ArgumentsAndPropertiesNut()
           
 
Method Summary
 void addArg(Arg a)
           
 void addArgs(Args a)
           
 void addProp(Prop prop)
           
protected  Component applyArguments(Component component)
          Apply the specified parameters if any.
protected  Component applyProperties(Component component)
          Create bean component is any property name is specified or any property value is specified.
 boolean containsExplicitProperty(java.lang.String key)
          Is the a property explicitly specified?
protected  Component decorateComponent(Component component)
          Apply arguments and then properties to the component.
protected  Component defineBean(Component c, boolean isAll)
          Create a bean component and filter out the undesired properties.
 java.util.List getArgList()
           
 java.lang.Object[] getArgs()
           
 PropertyBinder getAutoWire()
          Get the specified autowire mode.
 int getMaxArgsCount()
          Get the maximum number of the arguments.
 ParameterBinder getParameterAutowireMode()
          Get the auto wire mode for parameters.
 java.lang.Class[] getParameterTypes()
           
 PropertyBinder getPropertyAutowireMode()
          Get the auto wire mode for properties.
 java.lang.String[] getPropertyNames()
           
protected  Component informAwares(Component c)
          In case the component implements any marker interface or has any specific method signature that is used to automatically set property, call them and set the corresponding properties.
 boolean isAllProperties()
          Is wildcard used?
protected  boolean isBeanByDefault()
          When no property names is specified, no property values are set, do we by default create a bean component?
 boolean isValidate_property_names()
           
 void setArgs(java.lang.Object[] args)
           
 void setAutowire(java.lang.String mode)
           
 void setOptional_properties(boolean flag)
           
 void setParams(java.lang.Class[] param_types)
           
 void setProperty_names(java.lang.String[] names)
           
 void setProps(java.util.Map props)
           
 void setValidate_property_names(boolean check_property_names)
           
 
Methods inherited from class jfun.yan.xml.nut.ComponentNut
eval
 
Methods inherited from class jfun.yan.xml.nut.Nut
cast, checkDuplicate, checkMandatory, checkMandatory, convert, getComponentClassLoader, getId, getNutClassLoader, getNutEnvironment, getParameterWiring, getPropertyWiring, getSequenceNumber, getTagLocation, getTagName, initGloballyDefined, initNutEnvironment, initSequenceNumber, initTagLocation, initTagName, isGloballyDefined, raise, raise, register, registerEagerInstantiation, setId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArgumentsAndPropertiesNut

public ArgumentsAndPropertiesNut()
Method Detail

getMaxArgsCount

public int getMaxArgsCount()
Get the maximum number of the arguments.

Returns:
the value of the maximal 1-based ordinal position of arguments. -1 is returned if no "args" or "arg" is specified.

getArgs

public java.lang.Object[] getArgs()

getArgList

public java.util.List getArgList()

setArgs

public void setArgs(java.lang.Object[] args)

getParameterTypes

public java.lang.Class[] getParameterTypes()

setParams

public void setParams(java.lang.Class[] param_types)

addArgs

public void addArgs(Args a)

addArg

public void addArg(Arg a)

applyArguments

protected Component applyArguments(Component component)
Apply the specified parameters if any.

Parameters:
component - the component to apply parameters.
Returns:
the result.

containsExplicitProperty

public boolean containsExplicitProperty(java.lang.String key)
Is the a property explicitly specified?

Parameters:
key - the property key.

isValidate_property_names

public boolean isValidate_property_names()

setValidate_property_names

public void setValidate_property_names(boolean check_property_names)

setProps

public void setProps(java.util.Map props)

setAutowire

public void setAutowire(java.lang.String mode)

getAutoWire

public PropertyBinder getAutoWire()
Get the specified autowire mode.


setProperty_names

public void setProperty_names(java.lang.String[] names)

getPropertyNames

public java.lang.String[] getPropertyNames()

addProp

public void addProp(Prop prop)

setOptional_properties

public void setOptional_properties(boolean flag)

defineBean

protected Component defineBean(Component c,
                               boolean isAll)
                        throws java.beans.IntrospectionException
Create a bean component and filter out the undesired properties.

Parameters:
c - the Component to inject properties.
isAll - whether we want all properties.
Returns:
the bean Component.
Throws:
java.beans.IntrospectionException - when introspection failed.

isBeanByDefault

protected boolean isBeanByDefault()
When no property names is specified, no property values are set, do we by default create a bean component?


applyProperties

protected Component applyProperties(Component component)
Create bean component is any property name is specified or any property value is specified.

Parameters:
component - the component to apply properties.
Returns:
the result.

informAwares

protected Component informAwares(Component c)
In case the component implements any marker interface or has any specific method signature that is used to automatically set property, call them and set the corresponding properties.

Parameters:
c - the component.
Returns:
the Component object that informs the "aware"s.

getPropertyAutowireMode

public PropertyBinder getPropertyAutowireMode()
Get the auto wire mode for properties. If not specified, use the global default setting.


getParameterAutowireMode

public ParameterBinder getParameterAutowireMode()
Get the auto wire mode for parameters. If not specified, use the global default setting.


isAllProperties

public boolean isAllProperties()
Is wildcard used?


decorateComponent

protected Component decorateComponent(Component component)
Apply arguments and then properties to the component.

Parameters:
component - the component to apply arguments and properties.
Returns:
the result.