Class CUnionDescriptor
- java.lang.Object
-
- net.morimekta.providence.descriptor.PDeclaredDescriptor<T>
-
- net.morimekta.providence.descriptor.PMessageDescriptor<T>
-
- net.morimekta.providence.descriptor.PUnionDescriptor<CUnion>
-
- net.morimekta.providence.reflect.contained.CUnionDescriptor
-
- All Implemented Interfaces:
java.lang.reflect.Type
,PDescriptor
,CAnnotatedDescriptor
,CMessageDescriptor
public class CUnionDescriptor extends PUnionDescriptor<CUnion> implements CMessageDescriptor
- Since:
- 07.09.15
- Author:
- Stein Eldar Johnsen
-
-
Constructor Summary
Constructors Constructor Description CUnionDescriptor(java.lang.String comment, java.lang.String packageName, java.lang.String name, java.util.List<CField<CUnion>> fields, java.util.Map<java.lang.String,java.lang.String> annotations, PDescriptorProvider implementing)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CUnion.Builder
builder()
CField<CUnion>
findFieldById(int id)
CField<CUnion>
findFieldByName(java.lang.String name)
CField<CUnion>
findFieldByPojoName(java.lang.String pojoName)
java.util.Set<java.lang.String>
getAnnotations()
Get set of available annotations.java.lang.String
getAnnotationValue(java.lang.String name)
Get the given annotation value.java.lang.String
getDocumentation()
The type comment is the last block of comment written before the type declaration.CField<CUnion>[]
getFields()
CInterfaceDescriptor
getImplementing()
Get interface descriptor this message implements.boolean
hasAnnotation(java.lang.String name)
Get the given annotation value.boolean
isAutoType()
boolean
isInnerType()
boolean
isSimple()
-
Methods inherited from class net.morimekta.providence.descriptor.PUnionDescriptor
getVariant
-
Methods inherited from class net.morimekta.providence.descriptor.PMessageDescriptor
equals, fieldForId, fieldForName, fieldForPojoName, getBuilderSupplier, getType, hashCode
-
Methods inherited from class net.morimekta.providence.descriptor.PDeclaredDescriptor
getDefaultValue, getName, getProgramName, getQualifiedName, getTypeName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.reflect.contained.CAnnotatedDescriptor
getAnnotationValue, hasAnnotation
-
Methods inherited from interface net.morimekta.providence.reflect.contained.CMessageDescriptor
fieldForId, fieldForName, getVariant
-
Methods inherited from interface net.morimekta.providence.descriptor.PDescriptor
getDefaultValue, getName, getProgramName, getQualifiedName, getQualifiedName, getType
-
-
-
-
Constructor Detail
-
CUnionDescriptor
public CUnionDescriptor(java.lang.String comment, java.lang.String packageName, java.lang.String name, java.util.List<CField<CUnion>> fields, java.util.Map<java.lang.String,java.lang.String> annotations, PDescriptorProvider implementing)
-
-
Method Detail
-
isInnerType
public boolean isInnerType()
- Specified by:
isInnerType
in classPDeclaredDescriptor<CUnion>
- Returns:
- Returns true if the type is an inner type. Meaning it is contained within another type or service.
-
isAutoType
public boolean isAutoType()
- Specified by:
isAutoType
in classPDeclaredDescriptor<CUnion>
- Returns:
- Returns true if the type is generated automatically by means of something else, e.g. request and response types for services. Or is a built in type as part of providence itself.
-
getDocumentation
public final java.lang.String getDocumentation()
Description copied from interface:CAnnotatedDescriptor
The type comment is the last block of comment written before the type declaration. Comments on the same line, after the declaration is ignored.- Specified by:
getDocumentation
in interfaceCAnnotatedDescriptor
- Returns:
- The comment string containing all formatting (not including the comment delimiter and the leading space.
-
getFields
@Nonnull public CField<CUnion>[] getFields()
- Specified by:
getFields
in interfaceCMessageDescriptor
- Specified by:
getFields
in classPMessageDescriptor<CUnion>
- Returns:
- An unmodifiable list of fields that the struct holds.
-
findFieldByName
public CField<CUnion> findFieldByName(java.lang.String name)
- Specified by:
findFieldByName
in interfaceCMessageDescriptor
- Specified by:
findFieldByName
in classPMessageDescriptor<CUnion>
- Parameters:
name
- Name of field to get.- Returns:
- The field if present.
-
findFieldByPojoName
public CField<CUnion> findFieldByPojoName(java.lang.String pojoName)
- Specified by:
findFieldByPojoName
in classPMessageDescriptor<CUnion>
- Parameters:
pojoName
- POJO name of field.- Returns:
- The field if present.
-
findFieldById
public CField<CUnion> findFieldById(int id)
- Specified by:
findFieldById
in interfaceCMessageDescriptor
- Specified by:
findFieldById
in classPMessageDescriptor<CUnion>
- Parameters:
id
- The ID of the field to get.- Returns:
- The field if present.
-
getImplementing
@Nullable public CInterfaceDescriptor getImplementing()
Description copied from class:PMessageDescriptor
Get interface descriptor this message implements.- Specified by:
getImplementing
in interfaceCMessageDescriptor
- Overrides:
getImplementing
in classPMessageDescriptor<CUnion>
- Returns:
- The interface descriptor or null if not implementing declared interface.
-
isSimple
public boolean isSimple()
- Specified by:
isSimple
in interfaceCMessageDescriptor
- Overrides:
isSimple
in classPMessageDescriptor<CUnion>
- Returns:
- True if the message is simple. A simple message contains no containers, and no sub-messages.
-
getAnnotations
@Nonnull public java.util.Set<java.lang.String> getAnnotations()
Description copied from interface:CAnnotatedDescriptor
Get set of available annotations.- Specified by:
getAnnotations
in interfaceCAnnotatedDescriptor
- Returns:
- The annotation set.
-
hasAnnotation
public boolean hasAnnotation(@Nonnull java.lang.String name)
Description copied from interface:CAnnotatedDescriptor
Get the given annotation value.- Specified by:
hasAnnotation
in interfaceCAnnotatedDescriptor
- Parameters:
name
- Name of annotation.- Returns:
- If the annotation is present.
-
getAnnotationValue
public java.lang.String getAnnotationValue(@Nonnull java.lang.String name)
Description copied from interface:CAnnotatedDescriptor
Get the given annotation value.- Specified by:
getAnnotationValue
in interfaceCAnnotatedDescriptor
- Parameters:
name
- Name of annotation.- Returns:
- The annotation value or null.
-
builder
@Nonnull public CUnion.Builder builder()
- Overrides:
builder
in classPMessageDescriptor<CUnion>
-
-