Package hydra
Interface Annotations
-
public interface AnnotationsUtilities for reading and writing type and term annotations
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T0,T1,T2,T3>
java.util.Map<T2,T3>aggregateAnnotations(java.util.function.Function<T0,Optional<T1>> getValue, java.util.function.Function<T1,T0> getX, java.util.function.Function<T1,java.util.Map<T2,T3>> getAnns, T0 t)Aggregate annotations from nested structuresstatic <T0,T1,T2,T3>
java.util.List<java.util.List<Pair<T2,T3>>>aggregateAnnotations_toPairs(java.util.function.Function<T1,java.util.Map<T2,T3>> getAnns, java.util.function.Function<T0,Optional<T1>> getValue, java.util.function.Function<T1,T0> getX, java.util.List<java.util.List<Pair<T2,T3>>> rest, T0 t)static <T0> Either<Error_,Optional<java.lang.String>>commentsFromBinding(T0 cx, Graph g, Binding b)Extract comments/description from a Bindingstatic <T0> Either<Error_,Optional<java.lang.String>>commentsFromFieldType(T0 cx, Graph g, FieldType ft)Extract comments/description from a FieldTypestatic java.util.Map<Name,Term>getAnnotationMap(Term t)Project a Map<Name, Term> out of an annotation Term.static <T0> Optional<Pair<Name,T0>>getAnnotationMap_fromEntry(java.util.function.Function<Term,Optional<Name>> extractName, Pair<Term,T0> p)static <T0> T0getAnnotationMap_v(Pair<Term,T0> p)static <T0> Either<Error_,Optional<java.lang.String>>getDescription(T0 cx, Graph graph, java.util.Map<Name,Term> anns)Get description from annotations map (Either version)static Optional<Term>getTermAnnotation(Name key, Term term)Get a term annotationstatic <T0> Either<Error_,Optional<java.lang.String>>getTermDescription(T0 cx, Graph graph, Term term)Get term description (Either version)static Either<DecodingError,Optional<Type>>getType(Graph graph, java.util.Map<Name,Term> anns)Get type from annotationsstatic Optional<Term>getTypeAnnotation(Name key, Type typ)Get a type annotationstatic <T0> Either<Error_,java.util.Map<Name,java.util.Set<Name>>>getTypeClasses(T0 cx, Graph graph, Term term)Get type classes from term.static <T0> Either<Error_,Optional<java.lang.String>>getTypeDescription(T0 cx, Graph graph, Type typ)Get type description (Either version)static <T0> java.lang.BooleanhasDescription(java.util.Map<Name,T0> anns)Check if annotations contain descriptionstatic java.lang.BooleanhasTypeDescription(Type typ)Check if type has descriptionstatic java.lang.BooleanisNativeType(Binding el)For a typed term, decide whether a coder should encode it as a native type expression, or as a Hydra type expression.static TermnormalizeTermAnnotations(Term term)Normalize term annotationsstatic TypenormalizeTypeAnnotations(Type typ)Normalize type annotationsstatic <T0,T1>
java.util.Map<T0,T1>setAnnotation(T0 key, Optional<T1> val, java.util.Map<T0,T1> m)Set annotation in mapstatic java.util.Map<Name,Term>setDescription(Optional<java.lang.String> d, java.util.Map<Name,Term> v1)Set description in annotationsstatic TermsetTermAnnotation(Name key, Optional<Term> val, Term term)Set term annotationstatic TermsetTermDescription(Optional<java.lang.String> d, Term v1)Set term descriptionstatic java.util.Map<Name,Term>setType(Optional<Type> mt, java.util.Map<Name,Term> v1)Set type in annotationsstatic TypesetTypeAnnotation(Name key, Optional<Term> val, Type typ)Set type annotationstatic TermsetTypeClasses(java.util.Map<Name,java.util.Set<Name>> m, Term term)Set type classes on term.static TypesetTypeDescription(Optional<java.lang.String> d, Type v1)Set type descriptionstatic java.util.Map<Name,Term>termAnnotationInternal(Term term)Get internal term annotationsstatic java.util.Map<Name,Term>typeAnnotationInternal(Type typ)Get internal type annotationsstatic TermwrapAnnotationMap(java.util.Map<Name,Term> m)Wrap a Map<Name, Term> as a TermMap annotation.
-
-
-
Method Detail
-
aggregateAnnotations
static <T0,T1,T2,T3> java.util.Map<T2,T3> aggregateAnnotations(java.util.function.Function<T0,Optional<T1>> getValue, java.util.function.Function<T1,T0> getX, java.util.function.Function<T1,java.util.Map<T2,T3>> getAnns, T0 t)
Aggregate annotations from nested structures
-
aggregateAnnotations_toPairs
static <T0,T1,T2,T3> java.util.List<java.util.List<Pair<T2,T3>>> aggregateAnnotations_toPairs(java.util.function.Function<T1,java.util.Map<T2,T3>> getAnns, java.util.function.Function<T0,Optional<T1>> getValue, java.util.function.Function<T1,T0> getX, java.util.List<java.util.List<Pair<T2,T3>>> rest, T0 t)
-
commentsFromBinding
static <T0> Either<Error_,Optional<java.lang.String>> commentsFromBinding(T0 cx, Graph g, Binding b)
Extract comments/description from a Binding
-
commentsFromFieldType
static <T0> Either<Error_,Optional<java.lang.String>> commentsFromFieldType(T0 cx, Graph g, FieldType ft)
Extract comments/description from a FieldType
-
getAnnotationMap
static java.util.Map<Name,Term> getAnnotationMap(Term t)
Project a Map<Name, Term> out of an annotation Term. For a TermMap with TermVariable-shaped keys (or, transitionally, TermWrap-encoded Name keys), returns those (Name, value) entries; for any other shape, returns the empty map.
-
getAnnotationMap_fromEntry
static <T0> Optional<Pair<Name,T0>> getAnnotationMap_fromEntry(java.util.function.Function<Term,Optional<Name>> extractName, Pair<Term,T0> p)
-
getDescription
static <T0> Either<Error_,Optional<java.lang.String>> getDescription(T0 cx, Graph graph, java.util.Map<Name,Term> anns)
Get description from annotations map (Either version)
-
getTermAnnotation
static Optional<Term> getTermAnnotation(Name key, Term term)
Get a term annotation
-
getTermDescription
static <T0> Either<Error_,Optional<java.lang.String>> getTermDescription(T0 cx, Graph graph, Term term)
Get term description (Either version)
-
getType
static Either<DecodingError,Optional<Type>> getType(Graph graph, java.util.Map<Name,Term> anns)
Get type from annotations
-
getTypeAnnotation
static Optional<Term> getTypeAnnotation(Name key, Type typ)
Get a type annotation
-
getTypeClasses
static <T0> Either<Error_,java.util.Map<Name,java.util.Set<Name>>> getTypeClasses(T0 cx, Graph graph, Term term)
Get type classes from term. Each Set Name contains bare class identifiers (#275).
-
getTypeDescription
static <T0> Either<Error_,Optional<java.lang.String>> getTypeDescription(T0 cx, Graph graph, Type typ)
Get type description (Either version)
-
hasDescription
static <T0> java.lang.Boolean hasDescription(java.util.Map<Name,T0> anns)
Check if annotations contain description
-
hasTypeDescription
static java.lang.Boolean hasTypeDescription(Type typ)
Check if type has description
-
isNativeType
static java.lang.Boolean isNativeType(Binding el)
For a typed term, decide whether a coder should encode it as a native type expression, or as a Hydra type expression.
-
normalizeTermAnnotations
static Term normalizeTermAnnotations(Term term)
Normalize term annotations
-
setAnnotation
static <T0,T1> java.util.Map<T0,T1> setAnnotation(T0 key, Optional<T1> val, java.util.Map<T0,T1> m)Set annotation in map
-
setDescription
static java.util.Map<Name,Term> setDescription(Optional<java.lang.String> d, java.util.Map<Name,Term> v1)
Set description in annotations
-
setTermAnnotation
static Term setTermAnnotation(Name key, Optional<Term> val, Term term)
Set term annotation
-
setTermDescription
static Term setTermDescription(Optional<java.lang.String> d, Term v1)
Set term description
-
setType
static java.util.Map<Name,Term> setType(Optional<Type> mt, java.util.Map<Name,Term> v1)
Set type in annotations
-
setTypeAnnotation
static Type setTypeAnnotation(Name key, Optional<Term> val, Type typ)
Set type annotation
-
setTypeClasses
static Term setTypeClasses(java.util.Map<Name,java.util.Set<Name>> m, Term term)
Set type classes on term. The Set Name carries bare class identifiers (#275).
-
setTypeDescription
static Type setTypeDescription(Optional<java.lang.String> d, Type v1)
Set type description
-
termAnnotationInternal
static java.util.Map<Name,Term> termAnnotationInternal(Term term)
Get internal term annotations
-
typeAnnotationInternal
static java.util.Map<Name,Term> typeAnnotationInternal(Type typ)
Get internal type annotations
-
-