@Override public VariantNameIF makeVariantName(TopicNameIF name, Reader value, long length, LocatorIF datatype) { if (name == null) throw new NullPointerException(MSG_TOPIC_NAME_NOT_NULL); if (value == null) throw new NullPointerException(MSG_VARIANT_VALUE_NOT_NULL); if (datatype == null) throw new NullPointerException(MSG_VARIANT_DATATYPE_NOT_NULL); CrossTopicMapException.check(name, this.tm); VariantNameIF vname = new VariantName(tm); ((TopicName)name).addVariant(vname); vname.setReader(value, length, datatype); return vname; }
@Override public VariantNameIF makeVariantName(TopicNameIF name, Reader value, long length, LocatorIF datatype) { if (name == null) throw new NullPointerException(MSG_TOPIC_NAME_NOT_NULL); if (value == null) throw new NullPointerException(MSG_VARIANT_VALUE_NOT_NULL); if (datatype == null) throw new NullPointerException(MSG_VARIANT_DATATYPE_NOT_NULL); CrossTopicMapException.check(name, this.tm); VariantNameIF vname = new VariantName(txn); ((TopicName)name).addVariant(vname); vname.setReader(value, length, datatype); return vname; }
@Override public VariantNameIF makeVariantName(TopicNameIF name, Reader value, long length, LocatorIF datatype, Collection<TopicIF> scope) { if (name == null) throw new NullPointerException(MSG_TOPIC_NAME_NOT_NULL); if (value == null) throw new NullPointerException(MSG_VARIANT_VALUE_NOT_NULL); if (datatype == null) throw new NullPointerException(MSG_VARIANT_DATATYPE_NOT_NULL); CrossTopicMapException.check(name, this.tm); checkCollection(scope); VariantNameIF vname = new VariantName(tm); ((TopicName)name).addVariant(vname); vname.setReader(value, length, datatype); addScope(vname, scope); return vname; }
@Override public VariantNameIF makeVariantName(TopicNameIF name, Reader value, long length, LocatorIF datatype, Collection scope) { if (name == null) throw new NullPointerException(MSG_TOPIC_NAME_NOT_NULL); if (value == null) throw new NullPointerException(MSG_VARIANT_VALUE_NOT_NULL); if (datatype == null) throw new NullPointerException(MSG_VARIANT_DATATYPE_NOT_NULL); CrossTopicMapException.check(name, this.tm); checkCollection(scope); VariantNameIF vname = new VariantName(txn); ((TopicName)name).addVariant(vname); vname.setReader(value, length, datatype); addScope(vname, scope); return vname; }
/** * INTERNAL: Copies the variant value and datatype from the * source topic to the target topic. * * @since 4.0 */ public static void copyVariantData(VariantNameIF target, VariantNameIF source) { if (source.getLength() > DataTypes.SIZE_THRESHOLD) target.setReader(source.getReader(), source.getLength(), source.getDataType()); else target.setValue(source.getValue(), source.getDataType()); }
variant.setReader(ri, inlen, DataTypes.TYPE_BINARY);
public void testNonURILocator() { try { variant.setLocator(new GenericLocator("URG", "l/e")); fail("non URI-locator could be set"); } catch (ConstraintViolationException e) { } try { variant.setValue("foo", new GenericLocator("URG", "l/e")); fail("non URI datatype could be set"); } catch (ConstraintViolationException e) { } try { variant.setReader(new StringReader("foo"), 3, new GenericLocator("URG", "l/e")); fail("non URI datatype could be set"); } catch (ConstraintViolationException e) { } }