All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infrastructurebuilder.data.model.StructuredFieldMetadata Maven / Gradle / Ivy

The newest version!
// =================== DO NOT EDIT THIS FILE ====================
// Generated by Modello 1.11,
// any modifications will be overwritten.
// ==============================================================

package org.infrastructurebuilder.data.model;

/**
 * Class StructuredFieldMetadata.
 * 
 * @version $Revision$ $Date$
 */
public class StructuredFieldMetadata
    implements 
                org.infrastructurebuilder.data.IBDataStructuredDataFieldMetadata
            , java.io.Serializable, java.lang.Cloneable, org.infrastructurebuilder.data.model.DataSetInputLocationTracker
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Describes the field within the structured metadata that this
     * SFM describes, from a base of 0.  Default value set to -1 to
     * ensure setting proper index.
     */
    private int index = -1;

    /**
     * "name()" of an enumerated type from
     * IBDataStructuredDataMetadataType. Not required, but strongly
     * encouraged.
     */
    private String metadataType;

    /**
     * Field enumerations.
     */
    private java.util.List enumerations;

    /**
     * Describes the "maximum length" or "maximum size" of the data
     * in the field.
     */
    private String max;

    /**
     * Describes the "minimum length" or "maximum size" of the data
     * in the field.
     */
    private String min;

    /**
     * Describes if the field has a null value in it.  The only
     * "true" answer is the string 'true'.
     */
    private String nullable;

    /**
     * Field locations.
     */
    private java.util.Map locations;

    /**
     * Field location.
     */
    private DataSetInputLocation location;

    /**
     * Field indexLocation.
     */
    private DataSetInputLocation indexLocation;

    /**
     * Field metadataTypeLocation.
     */
    private DataSetInputLocation metadataTypeLocation;

    /**
     * Field enumerationsLocation.
     */
    private DataSetInputLocation enumerationsLocation;

    /**
     * Field maxLocation.
     */
    private DataSetInputLocation maxLocation;

    /**
     * Field minLocation.
     */
    private DataSetInputLocation minLocation;

    /**
     * Field nullableLocation.
     */
    private DataSetInputLocation nullableLocation;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addEnumeration.
     * 
     * @param string
     */
    public void addEnumeration( String string )
    {
        getEnumerations().add( string );
    } //-- void addEnumeration( String )

    /**
     * Method clone.
     * 
     * @return StructuredFieldMetadata
     */
    public StructuredFieldMetadata clone()
    {
        try
        {
            StructuredFieldMetadata copy = (StructuredFieldMetadata) super.clone();

            if ( this.enumerations != null )
            {
                copy.enumerations = new java.util.ArrayList();
                copy.enumerations.addAll( this.enumerations );
            }

            if ( copy.locations != null )
            {
                copy.locations = new java.util.LinkedHashMap( copy.locations );
            }

            return copy;
        }
        catch ( java.lang.Exception ex )
        {
            throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
                + " does not support clone()" ).initCause( ex );
        }
    } //-- StructuredFieldMetadata clone()

    /**
     * Method getEnumerations.
     * 
     * @return List
     */
    public java.util.List getEnumerations()
    {
        if ( this.enumerations == null )
        {
            this.enumerations = new java.util.ArrayList();
        }

        return this.enumerations;
    } //-- java.util.List getEnumerations()

    /**
     * Get describes the field within the structured metadata that
     * this SFM describes, from a base of 0.  Default value set to
     * -1 to ensure setting proper index.
     * 
     * @return int
     */
    public int getIndex()
    {
        return this.index;
    } //-- int getIndex()

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    public DataSetInputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "index" :
                {
                    return indexLocation;
                }
                case "metadataType" :
                {
                    return metadataTypeLocation;
                }
                case "enumerations" :
                {
                    return enumerationsLocation;
                }
                case "max" :
                {
                    return maxLocation;
                }
                case "min" :
                {
                    return minLocation;
                }
                case "nullable" :
                {
                    return nullableLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- DataSetInputLocation getLocation( Object )

    /**
     * Get describes the "maximum length" or "maximum size" of the
     * data in the field.
     * 
     * @return String
     */
    public String getMax()
    {
        return this.max;
    } //-- String getMax()

    /**
     * Get "name()" of an enumerated type from
     * IBDataStructuredDataMetadataType. Not required, but strongly
     * encouraged.
     * 
     * @return String
     */
    public String getMetadataType()
    {
        return this.metadataType;
    } //-- String getMetadataType()

    /**
     * Get describes the "minimum length" or "maximum size" of the
     * data in the field.
     * 
     * @return String
     */
    public String getMin()
    {
        return this.min;
    } //-- String getMin()

    /**
     * Get describes if the field has a null value in it.  The only
     * "true" answer is the string 'true'.
     * 
     * @return String
     */
    public String getNullable()
    {
        return this.nullable;
    } //-- String getNullable()

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setLocation( Object key, DataSetInputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "index" :
                {
                    indexLocation = location;
                    return;
                }
                case "metadataType" :
                {
                    metadataTypeLocation = location;
                    return;
                }
                case "enumerations" :
                {
                    enumerationsLocation = location;
                    return;
                }
                case "max" :
                {
                    maxLocation = location;
                    return;
                }
                case "min" :
                {
                    minLocation = location;
                    return;
                }
                case "nullable" :
                {
                    nullableLocation = location;
                    return;
                }
                default :
                {
                    setOtherLocation( key, location );
                    return;
                }
                }
            }
            else
            {
                setOtherLocation( key, location );
            }
    } //-- void setLocation( Object, DataSetInputLocation )

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setOtherLocation( Object key, DataSetInputLocation location )
    {
        if ( location != null )
        {
            if ( this.locations == null )
            {
                this.locations = new java.util.LinkedHashMap();
            }
            this.locations.put( key, location );
        }
    } //-- void setOtherLocation( Object, DataSetInputLocation )

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    private DataSetInputLocation getOtherLocation( Object key )
    {
        return ( locations != null ) ? locations.get( key ) : null;
    } //-- DataSetInputLocation getOtherLocation( Object )

    /**
     * Method removeEnumeration.
     * 
     * @param string
     */
    public void removeEnumeration( String string )
    {
        getEnumerations().remove( string );
    } //-- void removeEnumeration( String )

    /**
     * Set shows the list of (ordinal) enums that this field
     * posseses.  If not present, this is not assumed to not be an
     * enum.
     * 
     * @param enumerations
     */
    public void setEnumerations( java.util.List enumerations )
    {
        this.enumerations = enumerations;
    } //-- void setEnumerations( java.util.List )

    /**
     * Set describes the field within the structured metadata that
     * this SFM describes, from a base of 0.  Default value set to
     * -1 to ensure setting proper index.
     * 
     * @param index
     */
    public void setIndex( int index )
    {
        this.index = index;
    } //-- void setIndex( int )

    /**
     * Set describes the "maximum length" or "maximum size" of the
     * data in the field.
     * 
     * @param max
     */
    public void setMax( String max )
    {
        this.max = max;
    } //-- void setMax( String )

    /**
     * Set "name()" of an enumerated type from
     * IBDataStructuredDataMetadataType. Not required, but strongly
     * encouraged.
     * 
     * @param metadataType
     */
    public void setMetadataType( String metadataType )
    {
        this.metadataType = metadataType;
    } //-- void setMetadataType( String )

    /**
     * Set describes the "minimum length" or "maximum size" of the
     * data in the field.
     * 
     * @param min
     */
    public void setMin( String min )
    {
        this.min = min;
    } //-- void setMin( String )

    /**
     * Set describes if the field has a null value in it.  The only
     * "true" answer is the string 'true'.
     * 
     * @param nullable
     */
    public void setNullable( String nullable )
    {
        this.nullable = nullable;
    } //-- void setNullable( String )

    
            
    public StructuredFieldMetadata() {
    }            
          
    
            
    public StructuredFieldMetadata(org.infrastructurebuilder.data.IBDataStructuredDataFieldMetadata o) {
      this.index = o.getIndex();
      this.metadataType = o.getMetadataType();
      this.enumerations = new java.util.ArrayList<>(o.getEnumerations().stream().collect(java.util.stream.Collectors.toList()));
      this.max = o.getMax();
      this.min = o.getMin();
      this.nullable = o.getNullable();
    }
    
          
    
            
    public void setType(org.infrastructurebuilder.data.IBDataStructuredDataMetadataType t) {
        this.setMetadataType(java.util.Objects.requireNonNull(t, "IBDataStructuredDataMetadataType is null").name());
    }            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy