Package net.morimekta.providence.types
Class TypeReference
- java.lang.Object
-
- net.morimekta.providence.types.TypeReference
-
public final class TypeReference extends java.lang.ObjectSimple class to represent a type reference or declaration reference (e.g. for constant, typedef etc).
-
-
Field Summary
Fields Modifier and Type Field Description TypeReferencekeyTypejava.lang.StringprogramNamejava.lang.StringtypeNameTypeReferencevalueType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)inthashCode()booleanisContainer()booleanisList()booleanisMap()booleanisNativeType()booleanisSet()static TypeReferenceparseType(java.lang.String globalName)Create a type reference from a global reference name.static TypeReferenceparseType(java.lang.String programContext, java.lang.String typeName)Create a type reference from a program context.static TypeReferenceref(java.lang.String programContext, java.lang.String typeName)Create a simple type reference.java.lang.StringtoString()
-
-
-
Field Detail
-
programName
public final java.lang.String programName
-
typeName
public final java.lang.String typeName
-
keyType
public final TypeReference keyType
-
valueType
public final TypeReference valueType
-
-
Method Detail
-
isNativeType
public boolean isNativeType()
-
isContainer
public boolean isContainer()
-
isList
public boolean isList()
-
isSet
public boolean isSet()
-
isMap
public boolean isMap()
-
ref
@Nonnull public static TypeReference ref(@Nonnull java.lang.String programContext, @Nonnull java.lang.String typeName)
Create a simple type reference. This can only contain simple (program, type) references. The type name can contain '.', but only for service request and response types.- Parameters:
programContext- The local program context.typeName- The type name.- Returns:
- The type reference.
-
parseType
@Nonnull public static TypeReference parseType(@Nonnull java.lang.String globalName)
Create a type reference from a global reference name. This must include a program name and a type name, and nothing else.- Parameters:
globalName- The global type reference string.- Returns:
- The type reference.
-
parseType
@Nonnull public static TypeReference parseType(@Nonnull java.lang.String programContext, @Nonnull java.lang.String typeName)
Create a type reference from a program context. If the type name contains it's own program name (program.Type) then that program name is used, otherwise the local program context is used.- Parameters:
programContext- The local program context.typeName- The type name.- Returns:
- The type reference.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-