public int hashCode() { return namespace.getHashCodeForID(this); }
protected final static Namespace getNamespace0(Namespace n) { if (n == null) return null; return (Namespace) namespaces.get(n.getName()); }
public String getName() { return namespace.getNameForID(this); }
public ID createID(Namespace n, Object[] args) throws IDCreateException { // Verify namespace is non-null if (n == null) logAndThrow("Namespace cannot be null", null); //$NON-NLS-1$ initialize(); // Make sure that namespace is in table of known namespace. If not, // throw...we don't create any instances that we don't know about! Namespace ns = getNamespace0(n); if (ns == null) logAndThrow("Namespace " + n.getName() + " not found", null); //$NON-NLS-1$ return ns.createInstance(args); }
public String toString() { StringBuffer b = new StringBuffer("Namespace["); //$NON-NLS-1$ b.append("name=").append(name).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ b.append("scheme=").append(getScheme()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ b.append("description=").append("]"); //$NON-NLS-1$ //$NON-NLS-2$ return b.toString(); } }
/** * @param ns namespace to use for ID creation. Must not be <code>null</code> * @param parameters Map parameters to get value from * @param key the key to use to get value from parameters * @param type the expected type of the value from parameters * @param def a default value to use if value from parameters is null * @param <T> the expected value type * @return ID the created ID * @since 3.8 */ protected <T> ID getIDParameterValue(Namespace ns, Map<String, ?> parameters, String key, Class<T> type, T def) { return ns.createInstance(new Object[] {getParameterValue(parameters, key, type, def)}); }
public Namespace(String name, String desc) { initialize(name, desc); }
public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof BaseID)) { return false; } return namespace.testIDEquals(this, (BaseID) o); }
public int compareTo(Object o) { Assert.isTrue(o != null && o instanceof BaseID, "incompatible types for compare"); //$NON-NLS-1$ return namespace.getCompareToForObject(this, (BaseID) o); }
public String toExternalForm() { return namespace.toExternalForm(this); }
/** * Test whether two IDs are equal to one another. * * @param first * the first ID. Must not be <code>null</code>. * @param second * the second ID. Must not be <code>null</code>. * @return <code>true</code> if this ID is equal to the given ID. * <code>false</code> otherwise. */ protected boolean testIDEquals(BaseID first, BaseID second) { // First check that namespaces are the same and non-null Namespace sn = second.getNamespace(); if (sn == null || !this.equals(sn)) return false; return first.namespaceEquals(second); }
public ID createID(Namespace n, Object[] args) throws IDCreateException { // Verify namespace is non-null if (n == null) logAndThrow("Namespace cannot be null", null); //$NON-NLS-1$ initialize(); // Make sure that namespace is in table of known namespace. If not, // throw...we don't create any instances that we don't know about! Namespace ns = getNamespace0(n); if (ns == null) logAndThrow("Namespace " + n.getName() + " not found", null); //$NON-NLS-1$ return ns.createInstance(args); }
public String toString() { StringBuffer b = new StringBuffer("Namespace["); //$NON-NLS-1$ b.append("name=").append(name).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ b.append("scheme=").append(getScheme()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ b.append("description=").append("]"); //$NON-NLS-1$ //$NON-NLS-2$ return b.toString(); } }
public Namespace(String name, String desc) { initialize(name, desc); }
public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof BaseID)) { return false; } return namespace.testIDEquals(this, (BaseID) o); }
public int compareTo(Object o) { Assert.isTrue(o != null && o instanceof BaseID, "incompatible types for compare"); //$NON-NLS-1$ return namespace.getCompareToForObject(this, (BaseID) o); }
public String toExternalForm() { return namespace.toExternalForm(this); }
/** * Test whether two IDs are equal to one another. * * @param first * the first ID. Must not be <code>null</code>. * @param second * the second ID. Must not be <code>null</code>. * @return <code>true</code> if this ID is equal to the given ID. * <code>false</code> otherwise. */ protected boolean testIDEquals(BaseID first, BaseID second) { // First check that namespaces are the same and non-null Namespace sn = second.getNamespace(); if (sn == null || !this.equals(sn)) return false; return first.namespaceEquals(second); }
/** * @since 3.4 */ public final static Namespace removeNamespace0(Namespace n) { if (n == null) return null; return (Namespace) namespaces.remove(n.getName()); }
/** * @since 3.1 */ protected String getInitStringFromExternalForm(Object[] args) { if (args == null || args.length < 1 || args[0] == null) return null; if (args[0] instanceof String) { final String arg = (String) args[0]; if (arg.startsWith(getScheme() + SCHEME_SEPARATOR)) { final int index = arg.indexOf(SCHEME_SEPARATOR); if (index >= arg.length()) return null; return arg.substring(index + 1); } } return null; }