Package org.dmd.dmt.shared.generated.types

Source Code of org.dmd.dmt.shared.generated.types.TestOneLevelSubpackageREF

package org.dmd.dmt.shared.generated.types;

import org.dmd.dmc.DmcAttribute;
import org.dmd.dmc.DmcAttributeInfo;
import org.dmd.dmc.DmcObjectName;
import org.dmd.dmc.DmcValueException;
import org.dmd.dmc.DmcOutputStreamIF;
import org.dmd.dmc.DmcInputStreamIF;
import org.dmd.dmc.DmcNamedObjectNontransportableREF; // base import
import org.dmd.dmt.shared.generated.dmo.TestOneLevelSubpackageDMO; // primitive type
import org.dmd.dmc.types.StringName;
import org.dmd.dms.generated.types.DmcTypeStringNameSV;

import org.dmd.dms.generated.enums.ValueTypeEnum;
import org.dmd.dms.generated.enums.DataTypeEnum;
/**
* This is the generated DmcAttribute derivative for values of type TestOneLevelSubpackage
* <P>
* Generated from the dmt schema at version 0.1
* <P>
* This code was auto-generated by the dmogenerator utility and shouldn't be alterred manually!
* Generated from: org.dmd.dms.util.DmoTypeFormatter.dumpNamedREF(DmoTypeFormatter.java:420)
*/
@SuppressWarnings("serial")
public class TestOneLevelSubpackageREF extends DmcNamedObjectNontransportableREF<TestOneLevelSubpackageDMO> {

    public final static DmcAttributeInfo __name = new DmcAttributeInfo("name",2,"StringName",ValueTypeEnum.SINGLE,DataTypeEnum.PERSISTENT);
   
    DmcTypeStringNameSV myName;   
   
    public TestOneLevelSubpackageREF(){
    }

    public TestOneLevelSubpackageREF(TestOneLevelSubpackageDMO o){
         object = o;
         myName = (DmcTypeStringNameSV)o.getObjectNameAttribute();
    }

    public TestOneLevelSubpackageREF(StringName n) throws DmcValueException {
         object = null;
         myName = new DmcTypeStringNameSV(__name);
         myName.set(n);
    }

    public TestOneLevelSubpackageREF(String n) throws DmcValueException {
         object = null;
         myName = new DmcTypeStringNameSV(__name);
         myName.set(n);
    }

    public TestOneLevelSubpackageREF(TestOneLevelSubpackageREF original){
        myName = original.myName;
        object = original.object;
    }

    public void setObject(TestOneLevelSubpackageDMO o){
         object = o;
         if (object != null)
             myName = (DmcTypeStringNameSV)o.getObjectNameAttribute();
    }

    /**
     * Clones this reference.
     */
    public TestOneLevelSubpackageREF cloneMe(){
        TestOneLevelSubpackageREF rc = new TestOneLevelSubpackageREF();
        rc.myName = myName;
        rc.object = object;
        return(rc);
    }

    @Override
    public void setName(DmcObjectName n) throws DmcValueException {
        if (myName == null)
            myName = new DmcTypeStringNameSV(__name);
        myName.set(n);
    }

    @Override
    public DmcObjectName getObjectName(){
        if (myName == null)
            throw(new IllegalStateException("You've tried to access the name of an object but the name attribute hasn't been set."));
       
        return(myName.getSV());
    }

    public StringName getName(){
        if (myName == null)
            throw(new IllegalStateException("You've tried to access the name of an object but the name attribute hasn't been set."));
       
        return(myName.getSV());
    }

    @Override
    public DmcAttribute<?> getObjectNameAttribute(){
        if (myName == null)
            throw(new IllegalStateException("You've tried to access the name of an object but the name attribute hasn't been set."));
       
        return(myName);
    }

    public void serializeIt(DmcOutputStreamIF dos) throws Exception {
        myName.serializeIt(dos);
    }

    public void deserializeIt(DmcInputStreamIF dis) throws Exception {
        myName = (DmcTypeStringNameSV) dis.getAttributeInstance();
        myName.deserializeIt(dis);
    }

}
TOP

Related Classes of org.dmd.dmt.shared.generated.types.TestOneLevelSubpackageREF

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.