Search in sources :

Example 1 with DataTypeAttribute

use of org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute in project context-mapper-dsl by ContextMapper.

the class MDSLDataTypeCreator method createAttributes4ReferencesList.

private List<DataTypeAttribute> createAttributes4ReferencesList(List<Reference> references) {
    List<DataTypeAttribute> mdslAttributes = Lists.newArrayList();
    for (Reference reference : references) {
        DataType referencedType = createMDSLDataType(createComplexTypeForReference(reference));
        mdslAttributes.add(createAttribute(reference.getName(), referencedType.getName(), isCollection(reference.getCollectionType()), reference.isNullable()));
    }
    return mdslAttributes;
}
Also used : Reference(org.contextmapper.tactic.dsl.tacticdsl.Reference) DataTypeAttribute(org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute) DataType(org.contextmapper.dsl.generator.mdsl.model.DataType)

Example 2 with DataTypeAttribute

use of org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute in project context-mapper-dsl by ContextMapper.

the class MDSLDataTypeCreator method createAttributes4ParameterList.

private List<DataTypeAttribute> createAttributes4ParameterList(List<Parameter> parameters) {
    List<DataTypeAttribute> mdslAttributes = Lists.newArrayList();
    for (Parameter parameter : parameters) {
        DataType referencedType = createMDSLDataType(parameter.getParameterType());
        mdslAttributes.add(createAttribute(parameter.getName(), referencedType.getName(), isCollection(parameter.getParameterType().getCollectionType()), false));
    }
    return mdslAttributes;
}
Also used : DataTypeAttribute(org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute) Parameter(org.contextmapper.tactic.dsl.tacticdsl.Parameter) DataType(org.contextmapper.dsl.generator.mdsl.model.DataType)

Example 3 with DataTypeAttribute

use of org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute in project context-mapper-dsl by ContextMapper.

the class MDSLDataTypeCreator method createAttribute.

private DataTypeAttribute createAttribute(String attributeName, String attributeType, boolean isCollection, boolean isNullable) {
    DataTypeAttribute attribute = new DataTypeAttribute();
    attribute.setName(mdslNameEncoder.encodeName(attributeName));
    attribute.setType(mdslNameEncoder.encodeName(attributeType));
    attribute.setIsCollection(isCollection);
    attribute.setIsNullable(isNullable);
    return attribute;
}
Also used : DataTypeAttribute(org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute)

Example 4 with DataTypeAttribute

use of org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute in project context-mapper-dsl by ContextMapper.

the class MDSLDataTypeCreator method createAttributesForEnum.

private List<DataTypeAttribute> createAttributesForEnum(Enum enumm) {
    List<DataTypeAttribute> attributes = new ArrayList<>();
    for (EnumValue value : enumm.getValues()) {
        DataTypeAttribute attribute = new DataTypeAttribute();
        attribute.setName(mdslNameEncoder.encodeName(value.getName()));
        attribute.setType(mdslNameEncoder.encodeName(enumm.getName()));
        attributes.add(attribute);
    }
    return attributes;
}
Also used : EnumValue(org.contextmapper.tactic.dsl.tacticdsl.EnumValue) DataTypeAttribute(org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute) ArrayList(java.util.ArrayList)

Aggregations

DataTypeAttribute (org.contextmapper.dsl.generator.mdsl.model.DataTypeAttribute)4 DataType (org.contextmapper.dsl.generator.mdsl.model.DataType)2 ArrayList (java.util.ArrayList)1 EnumValue (org.contextmapper.tactic.dsl.tacticdsl.EnumValue)1 Parameter (org.contextmapper.tactic.dsl.tacticdsl.Parameter)1 Reference (org.contextmapper.tactic.dsl.tacticdsl.Reference)1