/** * Checks if an attribute is an Identifier, String or URI MAL data type * * @param obj The attribute * @return True if the object can be read as a string */ public static boolean isStringAttribute(Attribute obj) { Integer shortFormPart = obj.getTypeShortForm(); if (shortFormPart == 6) { // Identifier return true; } if (shortFormPart == 15) { // String return true; } if (shortFormPart == 18) { // URI return true; } return false; }
@Override public void encodeAttribute(final Attribute value) throws MALException { try { checkForNull(value); outputStream.addByte(internalEncodeAttributeType(value.getTypeShortForm().byteValue())); value.encode(this); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
public static double getDouble(Attribute attr) { int type = attr.getTypeShortForm(); switch (type) { case Attribute._DOUBLE_TYPE_SHORT_FORM: //Already double. return ((Union) attr).getDoubleValue(); case Attribute._SHORT_TYPE_SHORT_FORM: // Short. return ((Union) attr).getShortValue(); case Attribute._USHORT_TYPE_SHORT_FORM: // UShort return ((UShort) attr).getValue(); case Attribute._INTEGER_TYPE_SHORT_FORM: // Integer return ((Union) attr).getIntegerValue(); case Attribute._UINTEGER_TYPE_SHORT_FORM: // UInteger return ((UInteger) attr).getValue(); case Attribute._LONG_TYPE_SHORT_FORM: // Long return ((Union) attr).getLongValue(); } return 0; }
@Override public void encodeAttribute(final Attribute value) throws MALException { try { checkForNull(value); outputStream.addByte(internalEncodeAttributeType(value.getTypeShortForm().byteValue())); value.encode(this); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
arg.setRawType(Union.DOUBLE_TYPE_SHORT_FORM.byteValue()); } else { arg.setRawType(argumentValue.getValue().getTypeShortForm().byteValue()); // Check what is the type and stamp it
pDef.setRawType(Union.DOUBLE_TYPE_SHORT_FORM.byteValue()); } else { pDef.setRawType(parameters.get(i).getParameterValue().getRawValue().getTypeShortForm().byteValue()); // Check what is the type and stamp it
if (compositeFilter.getFieldValue().getTypeShortForm() != 15) { // Is it String? return false;
if (!newValue.getRawValue().getTypeShortForm().equals(new Integer(pDef.getRawType()))) { invIndexList.add(new UInteger(index)); continue;
int defRawType = actionDef.getArguments().get(index).getRawType().intValue(); int defConvType = actionDef.getArguments().get(index).getConvertedType().intValue(); int instType = actionInstance.getArgumentValues().get(index).getValue().getTypeShortForm(); boolean isRawValue = (actionInstance.getIsRawValue() == null) || (actionInstance.getIsRawValue().get(index) == null)