Search in sources :

Example 1 with ArrayType

use of org.bimserver.models.store.ArrayType in project BIMserver by opensourceBIM.

the class PluginConfiguration method fromDefaults.

public static PluginConfiguration fromDefaults(ObjectDefinition settingsDefinition) {
    if (settingsDefinition == null) {
        return null;
    }
    PluginConfiguration pluginConfiguration = new PluginConfiguration();
    for (ParameterDefinition parameterDefinition : settingsDefinition.getParameters()) {
        if (parameterDefinition.getDefaultValue() != null) {
            Type value = parameterDefinition.getDefaultValue();
            Object newValue = null;
            if (value instanceof PrimitiveType) {
                if (value instanceof BooleanType) {
                    newValue = ((BooleanType) value).isValue();
                } else if (value instanceof StringType) {
                    newValue = ((StringType) value).getValue();
                } else if (value instanceof DoubleType) {
                    newValue = ((DoubleType) value).getValue();
                } else if (value instanceof LongType) {
                    newValue = ((LongType) value).getValue();
                } else if (value instanceof ByteArrayType) {
                    newValue = ((ByteArrayType) value).getValue();
                }
            } else if (value instanceof ArrayType) {
                throw new NotImplementedException("ArrayType not implemented");
            } else if (value instanceof ObjectType) {
                throw new NotImplementedException("ObjectType not implemented");
            }
            pluginConfiguration.values.put(parameterDefinition.getIdentifier(), newValue);
        }
    }
    return pluginConfiguration;
}
Also used : SLongType(org.bimserver.interfaces.objects.SLongType) LongType(org.bimserver.models.store.LongType) SStringType(org.bimserver.interfaces.objects.SStringType) StringType(org.bimserver.models.store.StringType) NotImplementedException(org.apache.commons.lang3.NotImplementedException) SBooleanType(org.bimserver.interfaces.objects.SBooleanType) BooleanType(org.bimserver.models.store.BooleanType) ByteArrayType(org.bimserver.models.store.ByteArrayType) SArrayType(org.bimserver.interfaces.objects.SArrayType) SByteArrayType(org.bimserver.interfaces.objects.SByteArrayType) ArrayType(org.bimserver.models.store.ArrayType) ObjectType(org.bimserver.models.store.ObjectType) SObjectType(org.bimserver.interfaces.objects.SObjectType) SBooleanType(org.bimserver.interfaces.objects.SBooleanType) SStringType(org.bimserver.interfaces.objects.SStringType) SLongType(org.bimserver.interfaces.objects.SLongType) BooleanType(org.bimserver.models.store.BooleanType) PrimitiveType(org.bimserver.models.store.PrimitiveType) SDoubleType(org.bimserver.interfaces.objects.SDoubleType) SType(org.bimserver.interfaces.objects.SType) ByteArrayType(org.bimserver.models.store.ByteArrayType) DoubleType(org.bimserver.models.store.DoubleType) LongType(org.bimserver.models.store.LongType) ObjectType(org.bimserver.models.store.ObjectType) Type(org.bimserver.models.store.Type) SArrayType(org.bimserver.interfaces.objects.SArrayType) SByteArrayType(org.bimserver.interfaces.objects.SByteArrayType) StringType(org.bimserver.models.store.StringType) SObjectType(org.bimserver.interfaces.objects.SObjectType) ArrayType(org.bimserver.models.store.ArrayType) SDoubleType(org.bimserver.interfaces.objects.SDoubleType) DoubleType(org.bimserver.models.store.DoubleType) ByteArrayType(org.bimserver.models.store.ByteArrayType) SByteArrayType(org.bimserver.interfaces.objects.SByteArrayType) PrimitiveType(org.bimserver.models.store.PrimitiveType) ParameterDefinition(org.bimserver.models.store.ParameterDefinition)

Aggregations

NotImplementedException (org.apache.commons.lang3.NotImplementedException)1 SArrayType (org.bimserver.interfaces.objects.SArrayType)1 SBooleanType (org.bimserver.interfaces.objects.SBooleanType)1 SByteArrayType (org.bimserver.interfaces.objects.SByteArrayType)1 SDoubleType (org.bimserver.interfaces.objects.SDoubleType)1 SLongType (org.bimserver.interfaces.objects.SLongType)1 SObjectType (org.bimserver.interfaces.objects.SObjectType)1 SStringType (org.bimserver.interfaces.objects.SStringType)1 SType (org.bimserver.interfaces.objects.SType)1 ArrayType (org.bimserver.models.store.ArrayType)1 BooleanType (org.bimserver.models.store.BooleanType)1 ByteArrayType (org.bimserver.models.store.ByteArrayType)1 DoubleType (org.bimserver.models.store.DoubleType)1 LongType (org.bimserver.models.store.LongType)1 ObjectType (org.bimserver.models.store.ObjectType)1 ParameterDefinition (org.bimserver.models.store.ParameterDefinition)1 PrimitiveType (org.bimserver.models.store.PrimitiveType)1 StringType (org.bimserver.models.store.StringType)1 Type (org.bimserver.models.store.Type)1