Class AbstractSAMLObjectBuilder<T extends org.opensaml.core.xml.XMLObject>

java.lang.Object
se.swedenconnect.opensaml.common.builder.AbstractSAMLObjectBuilder<T>
Type Parameters:
T - the type
All Implemented Interfaces:
SAMLObjectBuilder<T>
Direct Known Subclasses:
AbstractRequestBuilder, AbstractSSODescriptorBuilder, AssertionConsumerServiceBuilder, AttributeBuilder, AttributeConsumingServiceBuilder, ContactPersonBuilder, DigestMethodBuilder, DiscoveryResponseBuilder, EncryptionMethodBuilder, EntityAttributesBuilder, EntityDescriptorBuilder, ExtensionsBuilder, ExtensionsBuilder, KeyDescriptorBuilder, LogoBuilder, NameIDPolicyBuilder, OrganizationBuilder, RequestedAttributeBuilder, RequestedAuthnContextBuilder, ScopeBuilder, ScopingBuilder, SigningMethodBuilder, SingleLogoutServiceBuilder, SingleSignOnServiceBuilder, UIInfoBuilder

public abstract class AbstractSAMLObjectBuilder<T extends org.opensaml.core.xml.XMLObject> extends Object implements SAMLObjectBuilder<T>
Abstract base class for the builder pattern.
Author:
Martin Lindström (martin@idsec.se)
  • Constructor Details

    • AbstractSAMLObjectBuilder

      public AbstractSAMLObjectBuilder()
      Constructor setting up the object to build.
    • AbstractSAMLObjectBuilder

      public AbstractSAMLObjectBuilder(T template) throws SAMLObjectBuilderRuntimeException
      Constructor setting up the builder with a template object. Users of the instance may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.

      Maps to AbstractSAMLObjectBuilder(XMLObject, boolean) with the clone parameter set to true.

      Parameters:
      template - the template object
      Throws:
      SAMLObjectBuilderRuntimeException - for marshalling/unmarshalling errors
    • AbstractSAMLObjectBuilder

      public AbstractSAMLObjectBuilder(T template, boolean clone) throws SAMLObjectBuilderRuntimeException
      Constructor setting up the builder with a template object. Users of the instance may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.

      The clone parameter tells whether the object should be cloned or not. If set to true, any modifications will have no effect on the passed object.

      Parameters:
      template - the template object
      clone - whether the template object should be cloned
      Throws:
      SAMLObjectBuilderRuntimeException - for marshalling/unmarshalling errors
    • AbstractSAMLObjectBuilder

      public AbstractSAMLObjectBuilder(InputStream resource) throws net.shibboleth.shared.xml.XMLParserException, org.opensaml.core.xml.io.UnmarshallingException
      Constructor setting up the builder with a template object that is read from an input stream. Users of the instance may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.
      Parameters:
      resource - the template resource
      Throws:
      org.opensaml.core.xml.io.UnmarshallingException - for unmarshalling errors
      net.shibboleth.shared.xml.XMLParserException - for XML parsing errors
  • Method Details

    • build

      public T build()
      The default implementation of this method assumes that the object has been built during assignment of its attributes and elements, so it simply returns the object.

      Implementations that need to perform additional processing during the build step should override this method.

      Specified by:
      build in interface SAMLObjectBuilder<T extends org.opensaml.core.xml.XMLObject>
      Returns:
      the built object
    • getObjectType

      protected abstract Class<T> getObjectType()
      Returns the object type.
      Returns:
      the object type
    • object

      public final T object()
      Returns the object being built.
      Returns:
      the object
    • getDefaultElementName

      protected QName getDefaultElementName()
      Gets the default element name for the object.
      Returns:
      a QName