public OGlobalProperty createGlobalProperty( final String name, final OType type, final Integer id) { OGlobalProperty global; if (id < properties.size() && (global = properties.get(id)) != null) { if (!global.getName().equals(name) || !global.getType().equals(type)) throw new OSchemaException("A property with id " + id + " already exist "); return global; } global = new OGlobalPropertyImpl(name, type, id); ensurePropertiesSize(id); properties.set(id, global); propertiesByNameType.put(global.getName() + "|" + global.getType().name(), global); return global; }
protected OGlobalProperty findOrCreateGlobalProperty(final String name, final OType type) { OGlobalProperty global = propertiesByNameType.get(name + "|" + type.name()); if (global == null) { int id = properties.size(); global = new OGlobalPropertyImpl(name, type, id); properties.add(id, global); propertiesByNameType.put(global.getName() + "|" + global.getType().name(), global); } return global; }