/** * Register an additional resource type * * @param name * @param namespace * @return int to be used for creation of a new <code>ResourceType</code> property * that contains this type. * @throws IllegalArgumentException if the given element is <code>null</code> or * if the registration fails for another reason. */ public static int registerResourceType(String name, Namespace namespace) { if (name == null || namespace == null) { throw new IllegalArgumentException("Cannot register a <null> resourcetype"); } TypeName tn = new TypeName(name, namespace); // avoid duplicate registrations if (NAMES.contains(tn)) { return NAMES.indexOf(tn); } // register new type if (NAMES.add(tn)) { return NAMES.size() - 1; } else { throw new IllegalArgumentException("Could not register resourcetype " + namespace.getPrefix() + name); } }
/** * Register an additional resource type * * @param name * @param namespace * @return int to be used for creation of a new <code>ResourceType</code> property * that contains this type. * @throws IllegalArgumentException if the given element is <code>null</code> or * if the registration fails for another reason. */ public static int registerResourceType(String name, Namespace namespace) { if (name == null || namespace == null) { throw new IllegalArgumentException("Cannot register a <null> resourcetype"); } TypeName tn = new TypeName(name, namespace); // avoid duplicate registrations if (NAMES.contains(tn)) { return NAMES.indexOf(tn); } // register new type if (NAMES.add(tn)) { return NAMES.size() - 1; } else { throw new IllegalArgumentException("Could not register resourcetype " + namespace.getPrefix() + name); } }
/** * Register an additional resource type * * @param name * @param namespace * @return int to be used for creation of a new <code>ResourceType</code> property * that contains this type. * @throws IllegalArgumentException if the given element is <code>null</code> or * if the registration fails for another reason. */ public static int registerResourceType(String name, Namespace namespace) { if (name == null || namespace == null) { throw new IllegalArgumentException("Cannot register a <null> resourcetype"); } TypeName tn = new TypeName(name, namespace); // avoid duplicate registrations if (NAMES.contains(tn)) { return NAMES.indexOf(tn); } // register new type if (NAMES.add(tn)) { return NAMES.size() - 1; } else { throw new IllegalArgumentException("Could not register resourcetype " + namespace.getPrefix() + name); } }