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;
}
Aggregations