com.evolveum.midpoint.prism
Class ItemDefinition

java.lang.Object
  extended by com.evolveum.midpoint.prism.Definition
      extended by com.evolveum.midpoint.prism.ItemDefinition
All Implemented Interfaces:
DebugDumpable, Dumpable, java.io.Serializable
Direct Known Subclasses:
PrismContainerDefinition, PrismPropertyDefinition, PrismReferenceDefinition

public abstract class ItemDefinition
extends Definition
implements java.io.Serializable

Abstract item definition in the schema. This is supposed to be a superclass for all item definitions. Items are things that can appear in property containers, which generally means only a property and property container itself. Therefore this is in fact superclass for those two definitions. The definitions represent data structures of the schema. Therefore instances of Java objects from this class represent specific definitions from the schema, not specific properties or objects. E.g the definitions does not have any value. To transform definition to a real property or object use the explicit instantiate() methods provided in the definition classes. E.g. the instantiate() method will create instance of Property using appropriate PropertyDefinition. The convenience methods in Schema are using this abstract class to find appropriate definitions easily.

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
protected  javax.xml.namespace.QName name
           
 
Fields inherited from class com.evolveum.midpoint.prism.Definition
defaultName, displayName, displayOrder, help, ignored, prismContext, typeName
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Method Summary
abstract  ItemDefinition clone()
           
protected  void copyDefinitionData(ItemDefinition clone)
           
abstract  ItemDelta createEmptyDelta(ItemPath path)
           
 boolean equals(java.lang.Object obj)
           
protected  void extendToString(java.lang.StringBuilder sb)
           
 javax.xml.namespace.QName getDefaultName()
          Returns default name for the defined entity.
 int getMaxOccurs()
          Return the number of maximal value occurrences.
 int getMinOccurs()
          Return the number of minimal value occurrences.
 javax.xml.namespace.QName getName()
          Returns name of the defined entity.
 javax.xml.namespace.QName getNameOrDefaultName()
          Returns either name (if specified) or default name.
 java.lang.String getNamespace()
           
 int hashCode()
           
abstract  Item instantiate()
          Create an item instance.
abstract  Item instantiate(javax.xml.namespace.QName name)
          Create an item instance.
 boolean isDynamic()
          Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML.
 boolean isMandatory()
          Returns true if property is mandatory.
 boolean isMultiValue()
          Returns true if property is multi-valued.
 boolean isOptional()
          Returns true if property is optional.
 boolean isSingleValue()
          Returns true if property is single-valued.
 boolean isValidFor(javax.xml.namespace.QName elementQName, java.lang.Class<? extends ItemDefinition> clazz)
           
 void setDynamic(boolean dynamic)
           
 void setMaxOccurs(int maxOccurs)
           
 void setMinOccurs(int minOccurs)
           
 void setName(javax.xml.namespace.QName name)
           
 java.lang.String toString()
           
 
Methods inherited from class com.evolveum.midpoint.prism.Definition
copyDefinitionData, debugDump, debugDump, dump, getDebugDumpClassName, getDisplayName, getDisplayOrder, getHelp, getPrismContext, getSchemaRegistry, getTypeClass, getTypeName, isIgnored, setDisplayName, setDisplayOrder, setHelp, setIgnored, setTypeName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected javax.xml.namespace.QName name
Method Detail

getName

public javax.xml.namespace.QName getName()
Returns name of the defined entity. The name is a name of the entity instance if it is fixed by the schema. E.g. it may be a name of the property in the container that cannot be changed. The name corresponds to the XML element name in the XML representation of the schema. It does NOT correspond to a XSD type name. Name is optional. If name is not set the null value is returned. If name is not set the type is "abstract", does not correspond to the element.

Returns:
the name name of the entity or null.

setName

public void setName(javax.xml.namespace.QName name)

getDefaultName

public javax.xml.namespace.QName getDefaultName()
Description copied from class: Definition
Returns default name for the defined entity. The default name is the name that the entity usually takes, but a name that is not fixed by the schema. The name corresponds to the XML element name in the XML representation of the schema. It does NOT correspond to a XSD type name. For example the default name may be the element name that is usually used for a specific object (e.g. "user"), while the same object may be represented using other names that resolve to the same type. In XML representation it corresponds to "defaultElement" XSD annotation.

Overrides:
getDefaultName in class Definition
Returns:
the defaultName

getNameOrDefaultName

public javax.xml.namespace.QName getNameOrDefaultName()
Returns either name (if specified) or default name. Convenience method.

Returns:
name or default name

getNamespace

public java.lang.String getNamespace()

getMinOccurs

public int getMinOccurs()
Return the number of minimal value occurrences.

Returns:
the minOccurs

setMinOccurs

public void setMinOccurs(int minOccurs)

getMaxOccurs

public int getMaxOccurs()
Return the number of maximal value occurrences.

Any negative number means "unbounded".

Returns:
the maxOccurs

setMaxOccurs

public void setMaxOccurs(int maxOccurs)

isSingleValue

public boolean isSingleValue()
Returns true if property is single-valued.

Returns:
true if property is single-valued.

isMultiValue

public boolean isMultiValue()
Returns true if property is multi-valued.

Returns:
true if property is multi-valued.

isMandatory

public boolean isMandatory()
Returns true if property is mandatory.

Returns:
true if property is mandatory.

isOptional

public boolean isOptional()
Returns true if property is optional.

Returns:
true if property is optional.

isDynamic

public boolean isDynamic()
Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML. This means that the definition needs to be stored alongside the data to have a successful serialization "roundtrip". The definition is not part of any schema and therefore cannot be determined. It may even be different for every instance of the associated item (element name).


setDynamic

public void setDynamic(boolean dynamic)

isValidFor

public boolean isValidFor(javax.xml.namespace.QName elementQName,
                          java.lang.Class<? extends ItemDefinition> clazz)

instantiate

public abstract Item instantiate()
Create an item instance. Definition name or default name will used as an element name for the instance. The instance will otherwise be empty.

Returns:
created item instance

instantiate

public abstract Item instantiate(javax.xml.namespace.QName name)
Create an item instance. Definition name will use provided name. for the instance. The instance will otherwise be empty.

Returns:
created item instance

createEmptyDelta

public abstract ItemDelta createEmptyDelta(ItemPath path)

clone

public abstract ItemDefinition clone()
Overrides:
clone in class java.lang.Object

copyDefinitionData

protected void copyDefinitionData(ItemDefinition clone)

hashCode

public int hashCode()
Overrides:
hashCode in class Definition

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Definition

toString

public java.lang.String toString()
Overrides:
toString in class Definition

extendToString

protected void extendToString(java.lang.StringBuilder sb)


Copyright © 2012 evolveum. All Rights Reserved.