@Override public Class<?> getType() { return indexedType.getPojoType(); }
@Override public void put(IndexedTypeIdentifier type, V value) { //technically there's a race condition here but we only do //writes during initialization, which is sequential. //Writing the names first makes this safe even for parallel //initializations. name2keyMapping.put( type.getName(), type ); map.put( type, value ); }
public static IndexedTypeSet composite(final IndexedTypeSet set, final IndexedTypeIdentifier additionalId) { return composite( set, additionalId.asTypeSet() ); }
@Test public void subtractionOfOneFromCouple() { assertIsSingletonSet( IndexedTypeSets.subtraction( IndexedTypeSets.composite( TYPE_A.asTypeSet(), TYPE_B ), TYPE_B.asTypeSet() ), TYPE_A.getPojoType(), true ); assertIsSingletonSet( IndexedTypeSets.subtraction( IndexedTypeSets.composite( TYPE_A.asTypeSet(), TYPE_B ), TYPE_A.asTypeSet() ), TYPE_B.getPojoType(), true ); }
public static IndexedTypeSet composite(final IndexedTypeSet set, final IndexedTypeIdentifier additionalId) { return composite( set, additionalId.asTypeSet() ); }
private void assertIsSingletonSet(IndexedTypeSet typeSet, Class<?> someType, boolean recursive) { Assert.assertFalse( "Verify it's not a singleton", typeSet == IndexedTypeSets.empty() ); Assert.assertFalse( typeSet.isEmpty() ); Assert.assertEquals( 1, typeSet.size() ); Iterator<IndexedTypeIdentifier> iterator = typeSet.iterator(); Assert.assertTrue( iterator.hasNext() ); IndexedTypeIdentifier firstElement = iterator.next(); // increment once Assert.assertFalse( iterator.hasNext() ); iterator.forEachRemaining( l -> Assert.fail( "should never happen" ) ); //no more elements Set<Class<?>> pojosSet = typeSet.toPojosSet(); Assert.assertTrue( pojosSet.contains( someType ) ); Assert.assertEquals( 1, pojosSet.size() ); IndexedTypeSet typeSet2 = firstElement.asTypeSet(); if ( recursive ) { assertIsSingletonSet( typeSet2, someType, false ); } Assert.assertEquals( typeSet2, typeSet2 ); Assert.assertEquals( firstElement.getPojoType(), someType ); }
@Override public Class<?> getType() { return indexedType.getPojoType(); }
@Override public void put(IndexedTypeIdentifier type, V value) { //technically there's a race condition here but we only do //writes during initialization, which is sequential. //Writing the names first makes this safe even for parallel //initializations. name2keyMapping.put( type.getName(), type ); map.put( type, value ); }
private static IndexedTypeSet fromSafeHashSet(HashSet<IndexedTypeIdentifier> set) { if ( set.isEmpty() ) { return empty(); } else if ( set.size() == 1 ) { return set.iterator().next().asTypeSet(); } else { return new HashSetIndexedTypeSet( set ); } }
@Override @Deprecated public Class<?> getType() { return freeFormType.getPojoType(); }
@Override public String toString() { IndexedTypeIdentifier entityClass = this.getEntityType(); if ( entityClass == null ) { return "FlushLuceneWork: global"; } else { return "FlushLuceneWork: " + entityClass.getName(); } } }
private static IndexedTypeSet fromSafeHashSet(HashSet<IndexedTypeIdentifier> set) { if ( set.isEmpty() ) { return empty(); } else if ( set.size() == 1 ) { return set.iterator().next().asTypeSet(); } else { return new HashSetIndexedTypeSet( set ); } }
/** * @deprecated use {@link #getEntityType()}: this method will be removed! * @return the Class identifying the entity type */ @Deprecated public Class<?> getEntityClass() { return entityType.getPojoType(); }
public Builder analyzerDiscriminator(Discriminator discriminator, XMember discriminatorGetter) { if ( this.discriminator != null ) { throw new SearchException( "Multiple AnalyzerDiscriminator defined in the same class hierarchy: " + this.indexedType .getName() ); } this.discriminator = discriminator; this.discriminatorGetter = discriminatorGetter; return this; }
public static IndexedTypeSet fromIdentifiers(IndexedTypeIdentifier... types) { if ( types == null || types.length == 0 ) { // "null" needs to be acceptable to support some legacy use cases return empty(); } else if ( types.length == 1 ) { return types[0].asTypeSet(); } else { return Arrays.stream( types ).collect( streamCollector() ); } }
@Override @Deprecated public Class<?> getType() { return freeFormType.getPojoType(); }