@SuppressWarnings( "unchecked" ) private static <T> ValueFactory<T> getFactory( Map<PropertyType, ValueFactory<?>> factories, ValueFactory<T> defaultFactory ) { PropertyType type = defaultFactory.getPropertyType(); ValueFactory<?> factory = factories.get(type); if (factory == null) { factory = defaultFactory; factories.put(type, factory); } return (ValueFactory<T>)factory; }
protected Factory( ValueFactory<T> valueFactory ) { this.valueFactory = valueFactory; this.type = this.valueFactory.getPropertyType(); this.typeName = type.getName().toUpperCase(); }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.TypeSystem#getTypeFactory(java.lang.Object) */ public TypeFactory<?> getTypeFactory( Object prototype ) { ValueFactory<?> valueFactory = valueFactories.getValueFactory(prototype); if (valueFactory == null) return null; PropertyType type = valueFactory.getPropertyType(); assert type != null; return typeFactoriesByPropertyType.get(type); }
factories.put(factory.getPropertyType(), factory);