Class DeriveUtilsImpl
java.lang.Object
org.derive4j.processor.DeriveUtilsImpl
- All Implemented Interfaces:
DeriveUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DeriveConfigBuilderprivate final Function<Flavour, Optional<EitherModel>> private final Elementsprivate final Function<Flavour, SamInterface> private final Function<Flavour, SamInterface> private final ObjectModelprivate final Function<Flavour, OptionModel> private final Types -
Constructor Summary
ConstructorsConstructorDescriptionDeriveUtilsImpl(Elements Elements, Types Types, DeriveConfigBuilder deriveConfigBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanallAbstractMethods(TypeElement typeElement) allAbstractMethods(DeclaredType declaredType) allStaticFields(TypeElement typeElement) allStaticMethods(TypeElement typeElement) asDeclaredType(TypeMirror typeMirror) private com.squareup.javapoet.CodeBlockasTypeArguments(Stream<? extends TypeMirror> typeVariables) asTypeElement(TypeMirror typeMirror) capitalize(CharSequence string) private Optional<EitherModel> eitherModel(String eitherClassQualifiedName, String leftConstructor, String rightConstructor) eitherModel(Flavour flavour) elements()private Optional<InstanceLocation> findCompiledInstance(TypeElement typeElementContext, TypeElement typeClass, TypeElement typeElement, DeclaredType declaredType, List<TypeElement> lowPriorityProviders, Optional<com.squareup.javapoet.ClassName> deriveTarget, Optional<com.squareup.javapoet.ClassName> deriveTargetExtend, Optional<com.squareup.javapoet.ClassName> contextExtend) private Function<TypeElement, Stream<InstanceLocation>> findCompiledInstanceIn(TypeElement typeElement, DeclaredType declaredType, Optional<com.squareup.javapoet.ClassName> deriveTarget, TypeMirror rawTypeClass) private Optional<DeclaredType> findFirstDeclaredTypeOf(TypeElement typeElement, TypeMirror inType) findInstance(TypeElement typeElementContext, com.squareup.javapoet.ClassName typeClassContext, com.squareup.javapoet.ClassName typeClass, TypeElement typeElement, DeclaredType declaredType, List<TypeElement> lowPriorityProviders) findTypeElement(com.squareup.javapoet.ClassName cn) function0Model(Flavour flavour) function1Model(Flavour flavour) private StringgeneratedInstanceMethodName(TypeElement typeClass, TypeElement typeElement) generateInstance(AlgebraicDataType adt, com.squareup.javapoet.ClassName typeClass, List<TypeElement> lowPriorityProviders, Function<InstanceUtils, DerivedCodeSpec> generateInstance) private static Stream<TypeElement> instanceInitializer(TypeElement typeElementContext, com.squareup.javapoet.ClassName typeClassContext, com.squareup.javapoet.ClassName typeClass, TypeMirror type, List<TypeElement> lowPriorityProviders) private StringinstanceVariableName(TypeElement typeClass, TypeMirror type) private BooleanisNotIn(List<FreeVariable> previousVars, FreeVariable var) booleanisWildcarded(TypeMirror typeMirror) private BoundExpressionjoin(BinaryOperator<Expression> expressionJoiner, BoundExpression b1, BoundExpression b2) private static ExpressionjoinAsArgs(Expression e1, Expression e2) com.squareup.javapoet.CodeBlocklambdaImpl(DataConstructor constructor, com.squareup.javapoet.CodeBlock impl) com.squareup.javapoet.CodeBlocklambdaImpl(DataConstructor constructor, String suffix, com.squareup.javapoet.CodeBlock impl) private OptionModellazyOptionModel(String optionClassQualifiedName, String noneConstructor, String someConstructor) private SamInterfacelazySamInterface(String samInterfaceQualifiedName) private List<FreeVariable> merge(List<FreeVariable> vbs1, List<FreeVariable> vbs2) object()optionModel(Flavour flavour) com.squareup.javapoet.MethodSpec.BuilderoverrideMethodBuilder(ExecutableElement abstractMethod, DeclaredType declaredType) com.squareup.javapoet.CodeBlockparameterList(DataConstructor constructor) com.squareup.javapoet.CodeBlockparameterList(DataConstructor constructor, String suffix) resolve(DeclaredType declaredType, Function<TypeVariable, Optional<TypeMirror>> typeArgs) resolve(TypeMirror typeMirror, Function<TypeVariable, Optional<TypeMirror>> typeArgs) resolveFieldInstances(AlgebraicDataType adt, com.squareup.javapoet.ClassName typeClass, List<TypeElement> lowPriorityProviders) com.squareup.javapoet.TypeNameresolveToTypeName(TypeMirror typeMirror, Function<TypeVariable, Optional<com.squareup.javapoet.TypeName>> typeArgs) samInterface(String qualifiedClassName) typeRestrictions(List<TypeRestriction> typeRestrictions) types()typeVariablesIn(TypeMirror typeMirror) private Stream<TypeVariable> typeVariablesIn0(TypeMirror typeMirror) uncapitalize(CharSequence string) unify(TypeMirror from, TypeMirror to) private Optional<HashMap<TypeVariable, TypeMirror>> unify0(TypeMirror from, TypeMirror to, HashMap<TypeVariable, TypeMirror> unified)
-
Field Details
-
Elements
-
Types
-
deriveConfigBuilder
-
objectModel
-
function0Model
-
function1Model
-
optionModel
-
eitherModel
-
-
Constructor Details
-
DeriveUtilsImpl
DeriveUtilsImpl(Elements Elements, Types Types, DeriveConfigBuilder deriveConfigBuilder)
-
-
Method Details
-
types
- Specified by:
typesin interfaceDeriveUtils
-
elements
- Specified by:
elementsin interfaceDeriveUtils
-
resolveToTypeName
public com.squareup.javapoet.TypeName resolveToTypeName(TypeMirror typeMirror, Function<TypeVariable, Optional<com.squareup.javapoet.TypeName>> typeArgs) - Specified by:
resolveToTypeNamein interfaceDeriveUtils
-
typeRestrictions
public Function<TypeVariable, Optional<TypeMirror>> typeRestrictions(List<TypeRestriction> typeRestrictions) - Specified by:
typeRestrictionsin interfaceDeriveUtils
-
resolve
public TypeMirror resolve(TypeMirror typeMirror, Function<TypeVariable, Optional<TypeMirror>> typeArgs) - Specified by:
resolvein interfaceDeriveUtils
-
unify
- Specified by:
unifyin interfaceDeriveUtils
-
unify0
private Optional<HashMap<TypeVariable, TypeMirror>> unify0(TypeMirror from, TypeMirror to, HashMap<TypeVariable, TypeMirror> unified) -
resolve
public DeclaredType resolve(DeclaredType declaredType, Function<TypeVariable, Optional<TypeMirror>> typeArgs) - Specified by:
resolvein interfaceDeriveUtils
-
overrideMethodBuilder
public com.squareup.javapoet.MethodSpec.Builder overrideMethodBuilder(ExecutableElement abstractMethod, DeclaredType declaredType) - Specified by:
overrideMethodBuilderin interfaceDeriveUtils
-
typeVariablesIn
- Specified by:
typeVariablesInin interfaceDeriveUtils
-
allAbstractMethods
- Specified by:
allAbstractMethodsin interfaceDeriveUtils
-
allAbstractMethods
- Specified by:
allAbstractMethodsin interfaceDeriveUtils
-
allStaticMethods
- Specified by:
allStaticMethodsin interfaceDeriveUtils
-
allStaticFields
- Specified by:
allStaticFieldsin interfaceDeriveUtils
-
asDeclaredType
- Specified by:
asDeclaredTypein interfaceDeriveUtils
-
asTypeElement
- Specified by:
asTypeElementin interfaceDeriveUtils
-
isWildcarded
- Specified by:
isWildcardedin interfaceDeriveUtils
-
object
- Specified by:
objectin interfaceDeriveUtils
-
samInterface
- Specified by:
samInterfacein interfaceDeriveUtils
-
function0Model
- Specified by:
function0Modelin interfaceDeriveUtils
-
function1Model
- Specified by:
function1Modelin interfaceDeriveUtils
-
optionModel
- Specified by:
optionModelin interfaceDeriveUtils
-
eitherModel
- Specified by:
eitherModelin interfaceDeriveUtils
-
uncapitalize
- Specified by:
uncapitalizein interfaceDeriveUtils
-
capitalize
- Specified by:
capitalizein interfaceDeriveUtils
-
findInstance
public Optional<InstanceLocation> findInstance(TypeElement typeElementContext, com.squareup.javapoet.ClassName typeClassContext, com.squareup.javapoet.ClassName typeClass, TypeElement typeElement, DeclaredType declaredType, List<TypeElement> lowPriorityProviders) - Specified by:
findInstancein interfaceDeriveUtils
-
instanceInitializer
public DeriveResult<BoundExpression> instanceInitializer(TypeElement typeElementContext, com.squareup.javapoet.ClassName typeClassContext, com.squareup.javapoet.ClassName typeClass, TypeMirror type, List<TypeElement> lowPriorityProviders) - Specified by:
instanceInitializerin interfaceDeriveUtils
-
resolveFieldInstances
public DeriveResult<FieldsTypeClassInstanceBindingMap> resolveFieldInstances(AlgebraicDataType adt, com.squareup.javapoet.ClassName typeClass, List<TypeElement> lowPriorityProviders) - Specified by:
resolveFieldInstancesin interfaceDeriveUtils
-
lambdaImpl
public com.squareup.javapoet.CodeBlock lambdaImpl(DataConstructor constructor, com.squareup.javapoet.CodeBlock impl) - Specified by:
lambdaImplin interfaceDeriveUtils
-
lambdaImpl
public com.squareup.javapoet.CodeBlock lambdaImpl(DataConstructor constructor, String suffix, com.squareup.javapoet.CodeBlock impl) - Specified by:
lambdaImplin interfaceDeriveUtils
-
generateInstance
public DeriveResult<DerivedCodeSpec> generateInstance(AlgebraicDataType adt, com.squareup.javapoet.ClassName typeClass, List<TypeElement> lowPriorityProviders, Function<InstanceUtils, DerivedCodeSpec> generateInstance) - Specified by:
generateInstancein interfaceDeriveUtils
-
parameterList
- Specified by:
parameterListin interfaceDeriveUtils
-
parameterList
- Specified by:
parameterListin interfaceDeriveUtils
-
findTypeElement
- Specified by:
findTypeElementin interfaceDeriveUtils
-
asTypeArguments
-
findFirstDeclaredTypeOf
-
instanceVariableName
-
generatedInstanceMethodName
-
allTypeArgsAsString
-
findCompiledInstance
private Optional<InstanceLocation> findCompiledInstance(TypeElement typeElementContext, TypeElement typeClass, TypeElement typeElement, DeclaredType declaredType, List<TypeElement> lowPriorityProviders, Optional<com.squareup.javapoet.ClassName> deriveTarget, Optional<com.squareup.javapoet.ClassName> deriveTargetExtend, Optional<com.squareup.javapoet.ClassName> contextExtend) -
findCompiledInstanceIn
private Function<TypeElement, Stream<InstanceLocation>> findCompiledInstanceIn(TypeElement typeElement, DeclaredType declaredType, Optional<com.squareup.javapoet.ClassName> deriveTarget, TypeMirror rawTypeClass) -
lazyOptionModel
private OptionModel lazyOptionModel(String optionClassQualifiedName, String noneConstructor, String someConstructor) -
eitherModel
private Optional<EitherModel> eitherModel(String eitherClassQualifiedName, String leftConstructor, String rightConstructor) -
lazySamInterface
-
typeVariablesIn0
-
abstractMethod
-
join
-
merge
-
isNotIn
-
join
private BoundExpression join(BinaryOperator<Expression> expressionJoiner, BoundExpression b1, BoundExpression b2) -
joinAsArgs
-
getSuperTypeElements
-