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

org.infrastructurebuilder.data.model.DataStreamStructuredMetadata 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 DataStreamStructuredMetadata.
 * 
 * @version $Revision$ $Date$
 */
public class DataStreamStructuredMetadata
    implements 
          org.infrastructurebuilder.data.IBDataStructuredDataMetadata
        , java.io.Serializable, java.lang.Cloneable, org.infrastructurebuilder.data.model.DataSetInputLocationTracker
{

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

    /**
     * UUID identifier of the datastream that this metadata
     * references.
     */
    private String uuid;

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

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

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

    /**
     * Field uuidLocation.
     */
    private DataSetInputLocation uuidLocation;

    /**
     * Field fieldsLocation.
     */
    private DataSetInputLocation fieldsLocation;


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

    /**
     * Method addField.
     * 
     * @param structuredFieldMetadata
     */
    public void addField( StructuredFieldMetadata structuredFieldMetadata )
    {
        getFields().add( structuredFieldMetadata );
    } //-- void addField( StructuredFieldMetadata )

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

            if ( this.fields != null )
            {
                copy.fields = new java.util.ArrayList();
                for ( StructuredFieldMetadata item : this.fields )
                {
                    copy.fields.add( ( (StructuredFieldMetadata) item).clone() );
                }
            }

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

            mutatingDataStreamStructuredMetadataCloneHook( copy );

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

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

        return this.fields;
    } //-- java.util.List getFields()

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    public DataSetInputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "uuid" :
                {
                    return uuidLocation;
                }
                case "fields" :
                {
                    return fieldsLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- DataSetInputLocation getLocation( Object )

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setLocation( Object key, DataSetInputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "uuid" :
                {
                    uuidLocation = location;
                    return;
                }
                case "fields" :
                {
                    fieldsLocation = 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 )

    /**
     * Get uUID identifier of the datastream that this metadata
     * references.
     * 
     * @return String
     */
    public String getUuid()
    {
        return this.uuid;
    } //-- String getUuid()

    /**
     * Method removeField.
     * 
     * @param structuredFieldMetadata
     */
    public void removeField( StructuredFieldMetadata structuredFieldMetadata )
    {
        getFields().remove( structuredFieldMetadata );
    } //-- void removeField( StructuredFieldMetadata )

    /**
     * Set list of structured data for a given field.
     * 
     * @param fields
     */
    public void setFields( java.util.List fields )
    {
        this.fields = fields;
    } //-- void setFields( java.util.List )

    /**
     * Set uUID identifier of the datastream that this metadata
     * references.
     * 
     * @param uuid
     */
    public void setUuid( String uuid )
    {
        this.uuid = uuid;
    } //-- void setUuid( String )

    
            

            // Default constructor (required because we're making a new one)
  public DataStreamStructuredMetadata() {
  }
            
          
    
            
            // Copy constructor
  public DataStreamStructuredMetadata(org.infrastructurebuilder.data.IBDataStructuredDataMetadata o) {
    this.uuid = o.getUuid();
    this.fields = o.getFields().stream().map(StructuredFieldMetadata::new).collect(java.util.stream.Collectors.toList());
  }
            
          
    
            
            // Clone hooks

  public void mutatingDataStreamStructuredMetadataCloneHook(DataStreamStructuredMetadata s) {
  }

  
          
    
            
    @Override
    public int hashCode() {
      return java.util.Objects.hash(fields, uuid);
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      if (obj == null)
        return false;
      if (getClass() != obj.getClass())
        return false;
      DataStreamStructuredMetadata other = (DataStreamStructuredMetadata) obj;
      return java.util.Objects.equals(fields, other.fields) && java.util.Objects.equals(uuid, other.uuid);
    }

    
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy