use of com.helger.commons.state.EMandatory in project phase4 by phax.
the class PModePayloadProfileJsonConverter method convertToNative.
@Nonnull
public static PModePayloadProfile convertToNative(final IJsonObject aElement) {
final String sName = aElement.getAsString(NAME);
final String sMimeType = aElement.getAsString(MIME_TYPE);
final IMimeType aMimeType;
try {
aMimeType = MimeTypeParser.parseMimeType(sMimeType);
} catch (final MimeTypeParserException ex) {
throw new IllegalArgumentException("Failed to parse MIME Type '" + sMimeType + "'", ex);
}
final String sXSDFilename = aElement.getAsString(XSD_FILENAME);
final Integer aMaxSizeKB = aElement.getAsIntObj(MAX_SIZE_KB);
final EMandatory eMandatory = EMandatory.valueOf(aElement.getAsBoolean(MANDATORY, PModePayloadProfile.DEFAULT_MANDATORY));
return new PModePayloadProfile(sName, aMimeType, sXSDFilename, aMaxSizeKB, eMandatory);
}
use of com.helger.commons.state.EMandatory in project phase4 by phax.
the class PModePayloadProfileMicroTypeConverter method convertToNative.
@Nonnull
public PModePayloadProfile convertToNative(final IMicroElement aElement) {
final String sName = aElement.getAttributeValue(ATTR_NAME);
final String sMimeType = aElement.getAttributeValue(ATTR_MIME_TYPE);
final IMimeType aMimeType;
try {
aMimeType = MimeTypeParser.parseMimeType(sMimeType);
} catch (final MimeTypeParserException ex) {
throw new IllegalArgumentException("Failed to parse MIME Type '" + sMimeType + "'", ex);
}
final String sXSDFilename = aElement.getAttributeValue(ATTR_XSD_FILENAME);
final Integer aMaxSizeKB = aElement.getAttributeValueWithConversion(ATTR_MAX_SIZE_KB, Integer.class);
final EMandatory eMandatory = EMandatory.valueOf(aElement.getAttributeValueAsBool(ATTR_MANDATORY, PModePayloadProfile.DEFAULT_MANDATORY));
return new PModePayloadProfile(sName, aMimeType, sXSDFilename, aMaxSizeKB, eMandatory);
}
use of com.helger.commons.state.EMandatory in project phase4 by phax.
the class PModePropertyJsonConverter method convertToNative.
@Nonnull
public static PModeProperty convertToNative(@Nonnull final IJsonObject aElement) {
final String sName = aElement.getAsString(NAME);
final String sDescription = aElement.getAsString(DESCRIPTION);
final String sDataType = aElement.getAsString(DATA_TYPE);
final EMandatory eMandatory = EMandatory.valueOf(aElement.getAsBoolean(MANDATORY, PModeProperty.DEFAULT_MANDATORY));
return new PModeProperty(sName, sDescription, sDataType, eMandatory);
}
use of com.helger.commons.state.EMandatory in project phase4 by phax.
the class PModePropertyMicroTypeConverter method convertToNative.
@Nonnull
public PModeProperty convertToNative(@Nonnull final IMicroElement aElement) {
final String sName = aElement.getAttributeValue(ATTR_NAME);
final String sDescription = aElement.getAttributeValue(ATTR_DESCRIPTION);
final String sDataType = aElement.getAttributeValue(ATTR_DATA_TYPE);
final EMandatory eMandatory = EMandatory.valueOf(aElement.getAttributeValueAsBool(ATTR_MANDATORY, PModeProperty.DEFAULT_MANDATORY));
return new PModeProperty(sName, sDescription, sDataType, eMandatory);
}
Aggregations