Package org.jvnet.hk2.config
Class ConfigModel
- java.lang.Object
-
- org.jvnet.hk2.config.ConfigModel
-
public final class ConfigModel extends Object
Describes the configuration model for a particular class (called "target type" in this class.) TODO: we need to remember if element values are single-valued or multi-valued.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfigModel.Nodestatic classConfigModel.Property
-
Field Summary
Fields Modifier and Type Field Description org.glassfish.hk2.api.HK2LoaderclassLoaderHolderDeferred reference to the class loader that loaded the injector.org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector>injectorReference to theConfigInjectorused to inject values to objects of this model.StringkeyIf this model has any property that works as a key.StringkeyedAsFully-qualified name under which this type is indexed.StringtargetTypeNameFully-qualified name of the target type that this injector works on.
-
Constructor Summary
Constructors Constructor Description ConfigModel(DomDocument document, org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector> injector, Map<String,List<String>> description, org.glassfish.hk2.api.ServiceLocator locator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringcamelCaseToXML(String camelCase)ConfigModel.PropertyfindIgnoreCase(String xmlName)Set<String>getAttributeNames()Returns the set of possible attributes names on this configuration model.MethodgetDuckMethod(Method method)Obtains the duck method implementation from a method on theConfigBeanProxy-derived interface.ConfigModel.PropertygetElement(String elementName)Returns the Property model for an element associated with this model or null of the element name is not known,ConfigModel.PropertygetElementFromXMlName(String xmlName)Set<String>getElementNames()Returns the list of all posible elements names on this modelSet<String>getLeafElementNames()Returns the list of all the leaf attribute names on this modelMap<String,List<String>>getMetadata()<T extends ConfigBeanProxy>
Class<T>getProxyType()Return the proxy type for this modelStringgetTagName()getter for tagNameConfigModel.PropertytoProperty(Method method)Obtain XML names (like "abc-def") from strings like "getAbcDef" and "hasAbcDef".static StringtrimPrefix(String name)
-
-
-
Field Detail
-
injector
public final org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector> injector
Reference to theConfigInjectorused to inject values to objects of this model.
-
classLoaderHolder
public final org.glassfish.hk2.api.HK2Loader classLoaderHolder
Deferred reference to the class loader that loaded the injector. This classloader can also load the configurable object.
-
targetTypeName
public final String targetTypeName
Fully-qualified name of the target type that this injector works on.
-
keyedAs
public final String keyedAs
Fully-qualified name under which this type is indexed. This is the class name where the key property is defined.Null if this type is not keyed.
-
key
public final String key
If this model has any property that works as a key.- See Also:
ConfigMetadata.KEY
-
-
Constructor Detail
-
ConfigModel
public ConfigModel(DomDocument document, org.glassfish.hk2.api.ActiveDescriptor<? extends ConfigInjector> injector, Map<String,List<String>> description, org.glassfish.hk2.api.ServiceLocator locator)
- Parameters:
description- The description of the model as written inthe inhabitants file.
-
-
Method Detail
-
getTagName
public String getTagName()
getter for tagName- Returns:
- the element name of this model itself, if this element can appear globally Otherwise null
-
getAttributeNames
public Set<String> getAttributeNames()
Returns the set of possible attributes names on this configuration model.- Returns:
- the set of all possible attributes names on this model
-
getProxyType
public <T extends ConfigBeanProxy> Class<T> getProxyType()
Return the proxy type for this model- Type Parameters:
T- the proxy type- Returns:
- the class object for this proxy type
-
getLeafElementNames
public Set<String> getLeafElementNames()
Returns the list of all the leaf attribute names on this model- Returns:
- the list of all leaf attribute names.
-
getElementNames
public Set<String> getElementNames()
Returns the list of all posible elements names on this model- Returns:
- the list of all posible elements names.
-
getElement
public ConfigModel.Property getElement(String elementName)
Returns the Property model for an element associated with this model or null of the element name is not known,- Parameters:
elementName- element name identifying the property- Returns:
- the Property instance describing the element
-
getElementFromXMlName
public ConfigModel.Property getElementFromXMlName(String xmlName)
-
getDuckMethod
public Method getDuckMethod(Method method) throws ClassNotFoundException, NoSuchMethodException
Obtains the duck method implementation from a method on theConfigBeanProxy-derived interface.
-
toProperty
public ConfigModel.Property toProperty(Method method)
Obtain XML names (like "abc-def") from strings like "getAbcDef" and "hasAbcDef".The conversion rule uses the model to find a good match.
-
findIgnoreCase
public ConfigModel.Property findIgnoreCase(String xmlName)
- Parameters:
xmlName- XML name to be searched.- Returns:
- null if none is found.
-
-