Package nz.org.riskscape.engine.typeset
Class TypeSet
java.lang.Object
nz.org.riskscape.engine.IdentifiedCollection.Base<CanonicalType>
nz.org.riskscape.engine.typeset.TypeSet
- All Implemented Interfaces:
IdentifiedCollection<CanonicalType>
,TypeRules
-
Nested Class Summary
Nested classes/interfaces inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base
IdentifiedCollection.Base.Handle
Nested classes/interfaces inherited from interface nz.org.riskscape.engine.IdentifiedCollection
IdentifiedCollection.Base<T extends Identified>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TypeSet
A jvm-global type set, only use with extreme prejudiceFields inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base
results
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addType
(String identifier, Resource resource, ConstructionCallback<Type> builder) void
Print some debug info to the TypeRules logger - this should be decorated with some extra context that helps put a particular rule checks logging more easily interpretedfindEquivalenceCoercer
(Type sourceType, Type targetType) Search through the list ofEquivalenceRule
s and find the first one that can safely coerce a value from the source type to the target type.getLinkedType
(@NonNull String id) getRequired
(@NonNull String id) Deprecated.getRequired
(@NonNull String id, ProblemSink problemSink) testVariance
(Type sourceType, Type targetType) Search through the list ofVarianceRule
s to determine whether a value of sourceType can be assigned to a receiver of targetTypevoid
Methods inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base
add, add, add, addAll, addAll, clear, containsKey, determineCollectionClass, get, getAll, getAllProblems, getCollectionClass, getOr, getReferences, getResult, getSimilarIds, isEmpty, remove, removeAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.IdentifiedCollection
get
Methods inherited from interface nz.org.riskscape.engine.typeset.TypeRules
isAssignable
-
Field Details
-
GLOBAL_TYPE_SET
A jvm-global type set, only use with extreme prejudice
-
-
Constructor Details
-
TypeSet
public TypeSet() -
TypeSet
-
-
Method Details
-
addType
-
add
public CanonicalType add(@NonNull @NonNull String id, @NonNull @NonNull Type type) throws ObjectAlreadyExistsException - Throws:
ObjectAlreadyExistsException
-
getLinkedType
-
getRequired
Deprecated. -
getRequired
-
findEquivalenceCoercer
Description copied from interface:TypeRules
Search through the list of
EquivalenceRule
s and find the first one that can safely coerce a value from the source type to the target type. This will return an object that will allow the source type to be safely converted to the target type.- Specified by:
findEquivalenceCoercer
in interfaceTypeRules
- Parameters:
sourceType
- the type of the value that is being assigned to something. typetargetType
- the receiving type- Returns:
- a
Coercer
, or empty if none could be found.
-
testVariance
Description copied from interface:TypeRules
Search through the list of
VarianceRule
s to determine whether a value of sourceType can be assigned to a receiver of targetType- Specified by:
testVariance
in interfaceTypeRules
- Parameters:
sourceType
- the type of the value that is being assigned to something.targetType
- the receiving type- Returns:
- a determined variance calculation, or
Variance.UNKNOWN
if it couldn't be determined. You should assume invariance if unknown is returned.
-
validate
-
debug
Description copied from interface:TypeRules
Print some debug info to the TypeRules logger - this should be decorated with some extra context that helps put a particular rule checks logging more easily interpreted
-
getTypeRegistry
-