Class IteratingWrapperClassBuilder
java.lang.Object
com.google.common.truth.codegen.IteratingWrapperClassBuilder
A builder of classes to wrap a provided SubjectFactory's concrete Subject subclass.
The generated class will be a direct subclass of the concrete Subject subclass, but
each public, protected, or friendly method not declared by Object will be wrapped
such that invocations on it will be invoked on a new Subject instance populated
with an element in the provided collection. This allows for a type-safe, IDE-discoverable
Subject in a for-each style.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringA string intended for use in String.format() representing the text of the code of the wrapper class.final Stringprivate static final Stringprivate final SubjectFactory<?, ?> private static final intprivate static final StringA string intended for use in String.format() representing the text of the code of all wrapped methods. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendMethodWrapper(StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) build()private static StringBuildermethodParameterList(int length) private static StringBuildermethodSignature(Class<?>[] parameters, Annotation[][] annotations) Builds a string for the parameters within a method signature.private static StringstringVisibility(int modifiers)
-
Field Details
-
CLASS_TEMPLATE
A string intended for use in String.format() representing the text of the code of the wrapper class.
Format parameters include:
- package name
- simple name of a concrete subtype of Subject
- the fully qualified name of the target type
- the text of the code of the wrapped methods
- See Also:
-
WRAPPER_METHOD_TEMPLATE
A string intended for use in String.format() representing the text of the code of all wrapped methods.
Format parameters include:
- visibility
- fully qualified name of the return type
- method name
- method's parameter list
- the target type of the Subject
- concrete subtype of Subject to be wrapped
- parameter list
- See Also:
-
TARGET_TYPE_PARAMETER
private static final int TARGET_TYPE_PARAMETER- See Also:
-
ITERATING_WRAPPER
- See Also:
-
subjectFactory
-
className
-
-
Constructor Details
-
IteratingWrapperClassBuilder
-
-
Method Details
-
build
-
appendMethodWrapper
private void appendMethodWrapper(StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) -
methodParameterList
-
methodSignature
Builds a string for the parameters within a method signature. -
stringVisibility
-