Class AttributeInfoBuilder
- java.lang.Object
-
- org.identityconnectors.framework.common.objects.AttributeInfoBuilder
-
public final class AttributeInfoBuilder extends Object
Simplifies the process of building 'AttributeInfo' objects. This class is responsible for providing a default implementation ofAttributeInfo.AttributeInfoBuilder bld = new AttributeInfoBuilder("email"); bld.setRequired(true); AttributeInfo info = bld.build();- Since:
- 1.0
- Author:
- Will Droste
-
-
Constructor Summary
Constructors Constructor Description AttributeInfoBuilder()Creates an builder with all the defaults set.AttributeInfoBuilder(String name)Creates an builder with all the defaults set.AttributeInfoBuilder(String name, Class<?> type)Creates an builder with all the defaults set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeInfobuild()Builds anAttributeInfoobject based on the properties set.static AttributeInfobuild(String name)Convenience method to create an AttributeInfo.static AttributeInfobuild(String name, Class<?> type)Convenience method to create an AttributeInfo.static AttributeInfobuild(String name, Class<?> type, Set<AttributeInfo.Flags> flags)Convenience method to create an AttributeInfo.static AttributeInfoBuilderdefine(String name)Convenience method to create a new AttributeInfoBuilder.static AttributeInfoBuilderdefine(String name, Class<?> type)Convenience method to create a new AttributeInfoBuilder.AttributeInfoBuildersetCreateable(boolean value)Determines if the attribute is writable.AttributeInfoBuildersetFlags(Set<AttributeInfo.Flags> flags)Sets all of the flags for this builder.AttributeInfoBuildersetMultiValued(boolean value)Determines if this attribute supports multivalue.AttributeInfoBuildersetName(String name)Sets the unique name of theAttributeInfoobject.AttributeInfoBuildersetNativeName(String nativeName)Sets the native name of theAttributeInfoobject.AttributeInfoBuildersetReadable(boolean value)Determines if the attribute is readable.AttributeInfoBuildersetReferencedObjectClassName(String value)AttributeInfoBuildersetRequired(boolean value)Determines if this attribute is required.AttributeInfoBuildersetReturnedByDefault(boolean value)AttributeInfoBuildersetRoleInReference(String value)AttributeInfoBuildersetSubtype(String subtype)Optional subtype of the attribute.AttributeInfoBuildersetSubtype(AttributeInfo.Subtypes subtype)AttributeInfoBuildersetType(Class<?> value)Please seeFrameworkUtil.checkAttributeType(Class)for the definitive list of supported types.AttributeInfoBuildersetUpdateable(boolean value)Determines if this attribute writable during update.
-
-
-
Constructor Detail
-
AttributeInfoBuilder
public AttributeInfoBuilder()
Creates an builder with all the defaults set. The name must be set before the 'build' method is called otherwise anIllegalStateExceptionis thrown.Name: <not set> Readable: true Writeable: true Required: false Type: string MultiValue: false
-
AttributeInfoBuilder
public AttributeInfoBuilder(String name)
Creates an builder with all the defaults set. The name must be set before the 'build' method is called otherwise anIllegalStateExceptionis thrown.Name: <not set> Readable: true Writeable: true Required: false Type: string MultiValue: false
-
AttributeInfoBuilder
public AttributeInfoBuilder(String name, Class<?> type)
Creates an builder with all the defaults set. The name must be set before the 'build' method is called otherwise anIllegalStateExceptionis thrown.Name: <not set> Readable: true Writeable: true Required: false Type: string MultiValue: false
-
-
Method Detail
-
build
public AttributeInfo build()
Builds anAttributeInfoobject based on the properties set.- Returns:
AttributeInfobased on the properties set.
-
setName
public AttributeInfoBuilder setName(String name)
Sets the unique name of theAttributeInfoobject.- Parameters:
name- unique name of theAttributeInfoobject.
-
setType
public AttributeInfoBuilder setType(Class<?> value)
Please seeFrameworkUtil.checkAttributeType(Class)for the definitive list of supported types.- Parameters:
value- type for anAttribute's value.- Throws:
IllegalArgumentException- if the Class is not a supported type.
-
setSubtype
public AttributeInfoBuilder setSubtype(String subtype)
Optional subtype of the attribute. This defines a subformat or provides more specific definition what the attribute contains. E.g. it may define that the attribute contains case-insensitive string, URL, LDAP distinguished name and so on. The subtype may contain one of the pre-defined subtypes (a value form the Subtype enumeration). The subtype may also contain an URI that specifies a custom subtype that the connector recognizes and it is not defined in the pre-defined subtype enumeration. SeeAttributeInfo#Subtypesfor the list of pre-defined subtypes.- Parameters:
subtype- subtype for anAttribute's value.
-
setSubtype
public AttributeInfoBuilder setSubtype(AttributeInfo.Subtypes subtype)
-
setNativeName
public AttributeInfoBuilder setNativeName(String nativeName)
Sets the native name of theAttributeInfoobject.- Parameters:
nativeName- native name of theAttributeInfoobject.
-
setReadable
public AttributeInfoBuilder setReadable(boolean value)
Determines if the attribute is readable.
-
setCreateable
public AttributeInfoBuilder setCreateable(boolean value)
Determines if the attribute is writable.
-
setRequired
public AttributeInfoBuilder setRequired(boolean value)
Determines if this attribute is required.
-
setMultiValued
public AttributeInfoBuilder setMultiValued(boolean value)
Determines if this attribute supports multivalue.
-
setUpdateable
public AttributeInfoBuilder setUpdateable(boolean value)
Determines if this attribute writable during update.
-
setReturnedByDefault
public AttributeInfoBuilder setReturnedByDefault(boolean value)
-
setFlags
public AttributeInfoBuilder setFlags(Set<AttributeInfo.Flags> flags)
Sets all of the flags for this builder.- Parameters:
flags- The set of attribute info flags. Null means clear all flags.NOTE: EnumSet.noneOf(AttributeInfo.Flags.class) results in an attribute with the default behavior:
- updateable
- creatable
- returned by default
- readable
- single-valued
- optional
-
setReferencedObjectClassName
public AttributeInfoBuilder setReferencedObjectClassName(String value)
-
setRoleInReference
public AttributeInfoBuilder setRoleInReference(String value)
-
build
public static AttributeInfo build(String name, Class<?> type, Set<AttributeInfo.Flags> flags)
Convenience method to create an AttributeInfo. Equivalent tonew AttributeInfoBuilder(name,type).setFlags(flags).build()- Parameters:
name- The name of the attributetype- The type of the attributeflags- The flags for the attribute. Null means clear all flags- Returns:
- The attribute info
-
build
public static AttributeInfo build(String name, Class<?> type)
Convenience method to create an AttributeInfo. Equivalent toAttributeInfoBuilder.build(name,type,null)- Parameters:
name- The name of the attributetype- The type of the attribute- Returns:
- The attribute info
-
build
public static AttributeInfo build(String name)
Convenience method to create an AttributeInfo. Equivalent toAttributeInfoBuilder.build(name, String.class)- Parameters:
name- The name of the attribute- Returns:
- The attribute info
-
define
public static AttributeInfoBuilder define(String name)
Convenience method to create a new AttributeInfoBuilder. Equivalent to:new AttributeInfoBuilder(name, String.class)- Parameters:
name- The name of the attribute- Returns:
- The attribute info builder with predefined name and type value.
- Since:
- 1.4
-
define
public static AttributeInfoBuilder define(String name, Class<?> type)
Convenience method to create a new AttributeInfoBuilder. Equivalent to:new AttributeInfoBuilder(name, type)- Parameters:
name- The name of the attributetype- The type of the attribute- Returns:
- The attribute info builder with predefined name and type value.
- Since:
- 1.4
-
-