/** * Populates the given Element with data from the given Type, by inserting Elements * corresponding to the Type's components and values. Returns true if the given type contains a * value (i.e. for Primitives, if getValue() doesn't return null, and for Composites, if at * least one underlying Primitive doesn't return null). */ private boolean encode(Type datatypeObject, Element datatypeElement) throws DataTypeException { boolean hasData = false; if (datatypeObject instanceof Varies) { hasData = encodeVaries((Varies) datatypeObject, datatypeElement); } else if (datatypeObject instanceof Primitive) { hasData = encodePrimitive((Primitive) datatypeObject, datatypeElement); } else if (datatypeObject instanceof Composite) { hasData = encodeComposite((Composite) datatypeObject, datatypeElement); } return hasData; }
/** * Populates the given Element with data from the given Type, by inserting Elements * corresponding to the Type's components and values. Returns true if the given type contains a * value (i.e. for Primitives, if getValue() doesn't return null, and for Composites, if at * least one underlying Primitive doesn't return null). */ private boolean encode(Type datatypeObject, Element datatypeElement) throws DataTypeException { boolean hasData = false; if (datatypeObject instanceof Varies) { hasData = encodeVaries((Varies) datatypeObject, datatypeElement); } else if (datatypeObject instanceof Primitive) { hasData = encodePrimitive((Primitive) datatypeObject, datatypeElement); } else if (datatypeObject instanceof Composite) { hasData = encodeComposite((Composite) datatypeObject, datatypeElement); } return hasData; }