com.connectifex.polymer.mdl.shared.generated.types.DmcTypeStringValue Maven / Gradle / Ivy
// Copyright 2020 connectifex
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package com.connectifex.polymer.mdl.shared.generated.types;
// Generated from: org.dmd.util.codegen.ImportManager.getFormattedImports(ImportManager.java:82)
// Called from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3297)
import java.io.Serializable; // Marker interface for serialization - (GenUtility.java:3278)
import java.util.Iterator; // For JSON formatting - (GenUtility.java:3279)
import org.dmd.dmc.DmcAttribute; // Derivation base - (GenUtility.java:3295)
import org.dmd.dmc.DmcAttributeInfo; // Constructor support - (GenUtility.java:3283)
import org.dmd.dmc.DmcInputStreamIF; // To support serialization - (GenUtility.java:3280)
import org.dmd.dmc.DmcOutputStreamIF; // To support serialization - (GenUtility.java:3281)
import org.dmd.dmc.DmcValueException; // Type checking - (GenUtility.java:3284)
@SuppressWarnings("serial")
/**
* The DmcTypeStringValue class.
* This code was auto-generated by the createmeta utility and shouldn't be alterred
* manually.
* Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3304)
* Called from: Called from: org.dmd.dms.util.NewComplexTypeFormatter.dumpComplexType(NewComplexTypeFormatter.java:1099)
*/
abstract public class DmcTypeStringValue extends DmcAttribute implements Serializable {
/**
* Default constructor.
*/
public DmcTypeStringValue(){
}
/**
* Default constructor.
*/
public DmcTypeStringValue(DmcAttributeInfo ai){
super(ai);
}
@Override
// Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3327)
protected void formatValueAsJSON(StringBuffer sb, int padding, String indent) {
if (getMVSize() == 0){
getSV().toJSON(sb,padding,indent);
}
else {
Iterator it = getMV();
while(it.hasNext()){
StringValue value = it.next();
value.toJSON(sb,padding,indent);
if (it.hasNext())
sb.append(", \n");
}
}
}
// Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3343)
protected StringValue typeCheck(Object value) throws DmcValueException {
StringValue rc = null;
if (value instanceof StringValue){
rc = (StringValue)value;
}
else if (value instanceof String){
rc = new StringValue((String)value);
}
else{
throw(new DmcValueException("Object of class: " + value.getClass().getName() + " passed where object compatible with StringValue expected."));
}
return(rc);
}
/**
* Returns a clone of a value associated with this type.
* Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3366)
*/
public StringValue cloneValue(StringValue val){
return(new StringValue(val));
}
/**
* Writes a StringValue.
* Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3374)
*/
@Override
public void serializeValue(DmcOutputStreamIF dos, StringValue value) throws Exception {
value.serializeIt(dos);
}
/**
* Reads a StringValue.
* Generated from: org.dmd.dms.util.GenUtility.dumpComplexTypeDmcType(GenUtility.java:3383)
*/
@Override
public StringValue deserializeValue(DmcInputStreamIF dis) throws Exception {
StringValue rc = new StringValue();
rc.deserializeIt(dis);
return(rc);
}
}