001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.isis.core.metamodel.spec; 018 019import java.util.Collection; 020import java.util.List; 021 022import org.apache.isis.core.commons.components.Injectable; 023import org.apache.isis.core.metamodel.facets.FacetFactory; 024import org.apache.isis.core.metamodel.facets.object.autocomplete.AutoCompleteFacet; 025 026public interface SpecificationLoader extends Injectable { 027 028 ObjectSpecification lookupBySpecId(ObjectSpecId objectSpecId); 029 030 /** 031 * Return the specification for the specified class of object. 032 * 033 * <p> 034 * It is possible for this method to return <tt>null</tt>, for example if 035 * the configured {@link #getClassSubstitutor()} has filtered out the class. 036 */ 037 ObjectSpecification loadSpecification(String fullyQualifiedClassName); 038 039 /** 040 * @see #loadSpecification(String) 041 */ 042 ObjectSpecification loadSpecification(Class<?> cls); 043 044 /** 045 * Loads the specifications of the specified types. 046 */ 047 boolean loadSpecifications(List<Class<?>> typesToLoad); 048 049 /** 050 * Loads the specifications of the specified types except the one specified 051 * (to prevent an infinite loop). 052 */ 053 boolean loadSpecifications(List<Class<?>> typesToLoad, final Class<?> typeToIgnore); 054 055 056 /** 057 * Typically does not need to be called, but is available for {@link FacetFactory}s to force 058 * early introspection of referenced specs in certain circumstances. 059 * 060 * <p> 061 * Originally introduced to support {@link AutoCompleteFacet}. 062 */ 063 ObjectSpecification introspectIfRequired(final ObjectSpecification spec); 064 065 066 Collection<ObjectSpecification> allSpecifications(); 067 068 069 List<Class<?>> getServiceClasses(); 070 071 /** 072 * Whether this class has been loaded. 073 */ 074 boolean loaded(Class<?> cls); 075 076 /** 077 * @see #loaded(Class). 078 */ 079 boolean loaded(String fullyQualifiedClassName); 080 081 082 void invalidateCache(Class<?> domainClass); 083 084}