Top Description Inners Fields Constructors Methods
org.springframework.aot.generate

public abstract Class ValueCodeGeneratorDelegates

extends Object
Class Inheritance
Imports
java.nio.charset.Charset, java.util.Arrays, .Collection, .Collections, .Iterator, .LinkedHashSet, .List, .Map, .Map.Entry, .Set, .TreeMap, .TreeSet, java.util.stream.Stream, org.springframework.aot.generate.ValueCodeGenerator.Delegate, org.springframework.core.ResolvableType, org.springframework.javapoet.CodeBlock, .CodeBlock.Builder, org.springframework.lang.Nullable, org.springframework.util.ClassUtils, .ObjectUtils

Code generator Delegate for well known value types.
Author
Stephane Nicoll
Since
6.1.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
public abstract static class
ValueCodeGeneratorDelegates.CollectionDelegate<
type the collection type
T extends Collection<?>
>

Abstract Delegate for Collection types.

private static class
private static class
public static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final List<ValueCodeGenerator.Delegate>
INSTANCES

Return the Delegate implementations for common value types.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCESback to summary
public static final List<ValueCodeGenerator.Delegate> INSTANCES

Return the Delegate implementations for common value types. These are:

  • Primitive types,
  • String,
  • Charset,
  • Enum,
  • Class,
  • ResolvableType,
  • Array,
  • List via List.of,
  • Set via Set.of and support of LinkedHashSet,
  • Map via Map.of or Map.ofEntries.
Those implementations do not require the ValueCodeGenerator to be scoped.

Constructor Detail

ValueCodeGeneratorDelegatesback to summary
public ValueCodeGeneratorDelegates()
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.ArrayDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.ArrayDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for array types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ArrayDelegateback to summary
private ArrayDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.CharsetDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.CharsetDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for Charset types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CharsetDelegateback to summary
private CharsetDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.ClassDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.ClassDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for Class types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassDelegateback to summary
private ClassDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
org.springframework.aot.generate back to summary

public abstract Class ValueCodeGeneratorDelegates.CollectionDelegate<T extends Collection<?>>

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.CollectionDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate
Known Direct Subclasses
org.springframework.aot.generate.ValueCodeGeneratorDelegates.ListDelegate, org.springframework.aot.generate.ValueCodeGeneratorDelegates.SetDelegate
Type Parameters
<T>
type the collection type

Abstract Delegate for Collection types.

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final CodeBlock

Constructor Summary

AccessConstructor and Description
protected
CollectionDelegate(Class<?> collectionType, CodeBlock emptyResult)

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
valueCodeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

protected CodeBlock
generateCollectionCode(ValueCodeGenerator valueCodeGenerator, T collection)

protected final CodeBlock
generateCollectionOf(ValueCodeGenerator valueCodeGenerator, Collection<?> collection, Class<?> collectionType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

collectionTypeback to summary
private final Class<?> collectionType
emptyResultback to summary
private final CodeBlock emptyResult

Constructor Detail

CollectionDelegateback to summary
protected CollectionDelegate(Class<?> collectionType, CodeBlock emptyResult)

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator valueCodeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
valueCodeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@SuppressWarnings:unchecked
generateCollectionCodeback to summary
protected CodeBlock generateCollectionCode(ValueCodeGenerator valueCodeGenerator, T collection)
generateCollectionOfback to summary
protected final CodeBlock generateCollectionOf(ValueCodeGenerator valueCodeGenerator, Collection<?> collection, Class<?> collectionType)
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.EnumDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.EnumDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for Enum types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EnumDelegateback to summary
private EnumDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.ListDelegate

extends ValueCodeGeneratorDelegates.CollectionDelegate<List<?>>
Class Inheritance

Delegate for List types.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from org.springframework.aot.generate.ValueCodeGeneratorDelegates.CollectionDelegate:
generateCodegenerateCollectionCodegenerateCollectionOf

Constructor Detail

ListDelegateback to summary
pack-priv ListDelegate()
org.springframework.aot.generate back to summary

public Class ValueCodeGeneratorDelegates.MapDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.MapDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for Map types.

Field Summary

Modifier and TypeField and Description
private static final CodeBlock

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
valueCodeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

protected CodeBlock

Returns:

the code that represents the specified map or null if the specified map is not supported.
generateMapCode
(ValueCodeGenerator
the code generator to use for embedded values
valueCodeGenerator
,
Map<?, ?>
the value to generate
map
)

Generate the code for a non-empty Map.

private <K, V> Map<K, V>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_RESULTback to summary
private static final CodeBlock EMPTY_RESULT

Constructor Detail

MapDelegateback to summary
public MapDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator valueCodeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
valueCodeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
generateMapCodeback to summary
protected CodeBlock generateMapCode(ValueCodeGenerator valueCodeGenerator, Map<?, ?> map)

Generate the code for a non-empty Map.

Parameters
valueCodeGenerator:ValueCodeGenerator

the code generator to use for embedded values

map:Map<?, ?>

the value to generate

Returns:CodeBlock

the code that represents the specified map or null if the specified map is not supported.

Annotations
@Nullable
orderForCodeConsistencyback to summary
private <K, V> Map<K, V> orderForCodeConsistency(Map<K, V> map)
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.PrimitiveDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.PrimitiveDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for primitive types.

Field Summary

Modifier and TypeField and Description
private static final Map<Character, String>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private String
escape(char ch)

public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHAR_ESCAPESback to summary
private static final Map<Character, String> CHAR_ESCAPES

Constructor Detail

PrimitiveDelegateback to summary
private PrimitiveDelegate()

Method Detail

escapeback to summary
private String escape(char ch)
generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.ResolvableTypeDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.ResolvableTypeDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for ResolvableType types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

private static CodeBlock
generateCode(ResolvableType resolvableType, boolean allowClassResult)

private static CodeBlock
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ResolvableTypeDelegateback to summary
private ResolvableTypeDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable
generateCodeback to summary
private static CodeBlock generateCode(ResolvableType resolvableType, boolean allowClassResult)
generateCodeWithGenericsback to summary
private static CodeBlock generateCodeWithGenerics(ResolvableType target, Class<?> type)
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.SetDelegate

extends ValueCodeGeneratorDelegates.CollectionDelegate<Set<?>>
Class Inheritance

Delegate for Set types.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected CodeBlock
private Set<?>
Inherited from org.springframework.aot.generate.ValueCodeGeneratorDelegates.CollectionDelegate:
generateCodegenerateCollectionOf

Constructor Detail

SetDelegateback to summary
pack-priv SetDelegate()

Method Detail

generateCollectionCodeback to summary
protected CodeBlock generateCollectionCode(ValueCodeGenerator valueCodeGenerator, Set<?> collection)

Overrides org.springframework.aot.generate.ValueCodeGeneratorDelegates.CollectionDelegate.generateCollectionCode.

Annotations
@Override
orderForCodeConsistencyback to summary
private Set<?> orderForCodeConsistency(Set<?> set)
org.springframework.aot.generate back to summary

private Class ValueCodeGeneratorDelegates.StringDelegate

extends Object
implements Delegate
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.generate.ValueCodeGeneratorDelegates.StringDelegate
All Implemented Interfaces
org.springframework.aot.generate.ValueCodeGenerator.Delegate

Delegate for String types.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public CodeBlock
generateCode(ValueCodeGenerator
the code generator to use for embedded values
codeGenerator
,
Object
the value to generate
value
)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringDelegateback to summary
private StringDelegate()

Method Detail

generateCodeback to summary
public CodeBlock generateCode(ValueCodeGenerator codeGenerator, Object value)

Implements org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Doc from org.springframework.aot.generate.ValueCodeGenerator.Delegate.generateCode.

Generate the code for the specified non-null value. If this instance does not support the value, it should return null to indicate so.

Parameters
codeGenerator:ValueCodeGenerator

the code generator to use for embedded values

value:Object

the value to generate

Returns:CodeBlock

the code that represents the specified value or null if the specified value is not supported.

Annotations
@Override
@Nullable