@Test(expected=IllegalStateException.class) public void testInitialize$cannotReinit() throws Exception { V v=new V(); new ImmutableTerm(v,"entity"); v.initialize(); v.initialize(); }
protected final void initialize() { checkStatus(Status.INITIALIZING); if(this.terms.size()!=this.nameOrdinal.size()) { throw new IllegalStateException( String.format( "Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered", this.namespace, getClass().getName())); } this.status=Status.INITIALIZED; }
AbstractImmutableVocabulary implements Vocabulary { protected final void initialize() { checkStatus(Status.INITIALIZING); if(this.terms.size()!=this.nameOrdinal.size()) { throw new IllegalStateException( String.format( "Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered", this.namespace, getClass().getName())); } this.status=Status.INITIALIZED; } }
AbstractImmutableVocabulary implements Vocabulary { protected final void initialize() { checkStatus(Status.INITIALIZING); if(this.terms.size()!=this.nameOrdinal.size()) { throw new IllegalStateException( String.format( "Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered", this.namespace, getClass().getName())); } this.status=Status.INITIALIZED; } AbstractImmutableVocabulary(Class<T> clazz, String namespace, String prefix); }
AbstractImmutableVocabulary implements Vocabulary { protected final void initialize() { checkStatus(Status.INITIALIZING); if(this.terms.size()!=this.nameOrdinal.size()) { throw new IllegalStateException( String.format( "Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered", this.namespace, getClass().getName())); } this.status=Status.INITIALIZED; } AbstractImmutableVocabulary(Class<T> clazz, String namespace, String prefix); final UUID getId(); @Override final String getNamespace(); @Override final String getPreferredPrefix(); @Override final T[] terms(); @Override final int size(); @Override final T fromName(String name); @Override T fromOrdinal(int ordinal); @Override final T fromValue(V value); @Override final Iterator<Term> iterator(); }
AbstractImmutableVocabulary implements Vocabulary { protected final void initialize() { checkStatus(Status.INITIALIZING); if(this.terms.size()!=this.nameOrdinal.size()) { throw new IllegalStateException( String.format( "Vocabulary '%s' (%s) initialization failure: not all reserved names have been registered", this.namespace, getClass().getName())); } this.status=Status.INITIALIZED; } AbstractImmutableVocabulary(Class<T> clazz, String namespace, String prefix); final UUID getId(); @Override final String getNamespace(); @Override final String getPreferredPrefix(); @Override final T[] terms(); @Override final int size(); @Override final T fromName(String name); @Override T fromOrdinal(int ordinal); @Override final T fromValue(V value); @Override final Iterator<Term> iterator();  }