Package io.protostuff.compiler.model
Class ImmutableModule
- java.lang.Object
-
- io.protostuff.compiler.model.ImmutableModule
-
- All Implemented Interfaces:
Module
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableModule extends Object implements Module
Immutable implementation ofModule.Use the builder to create immutable instances:
ImmutableModule.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableModule.BuilderBuilds instances of typeImmutableModule.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableModule.Builderbuilder()Creates a builder forImmutableModule.static ImmutableModulecopyOf(Module instance)Creates an immutable copy of aModulevalue.booleanequals(Object another)This instance is equal to all instances ofImmutableModulethat have equal attribute values.StringgetName()com.google.common.collect.ImmutableMap<String,Object>getOptions()StringgetOutput()com.google.common.collect.ImmutableList<Proto>getProtos()inthashCode()Computes a hash code from attributes:name,protos,output,options,usageIndex.StringtoString()Prints the immutable valueModulewith attribute values.UsageIndexusageIndex()ImmutableModulewithName(String value)Copy the current immutable object by setting a value for thenameattribute.ImmutableModulewithOptions(Map<String,? extends Object> entries)Copy the current immutable object by replacing theoptionsmap with the specified map.ImmutableModulewithOutput(String value)Copy the current immutable object by setting a value for theoutputattribute.ImmutableModulewithProtos(Proto... elements)Copy the current immutable object with elements that replace the content ofprotos.ImmutableModulewithProtos(Iterable<? extends Proto> elements)Copy the current immutable object with elements that replace the content ofprotos.ImmutableModulewithUsageIndex(UsageIndex value)Copy the current immutable object by setting a value for theusageIndexattribute.
-
-
-
Method Detail
-
getName
public String getName()
-
getProtos
public com.google.common.collect.ImmutableList<Proto> getProtos()
-
getOutput
public String getOutput()
-
getOptions
public com.google.common.collect.ImmutableMap<String,Object> getOptions()
- Specified by:
getOptionsin interfaceModule- Returns:
- The value of the
optionsattribute
-
usageIndex
public UsageIndex usageIndex()
- Specified by:
usageIndexin interfaceModule- Returns:
- The value of the
usageIndexattribute
-
withName
public final ImmutableModule withName(String value)
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withProtos
public final ImmutableModule withProtos(Proto... elements)
Copy the current immutable object with elements that replace the content ofprotos.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withProtos
public final ImmutableModule withProtos(Iterable<? extends Proto> elements)
Copy the current immutable object with elements that replace the content ofprotos. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of protos elements to set- Returns:
- A modified copy of
thisobject
-
withOutput
public final ImmutableModule withOutput(String value)
Copy the current immutable object by setting a value for theoutputattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for output- Returns:
- A modified copy of the
thisobject
-
withOptions
public final ImmutableModule withOptions(Map<String,? extends Object> entries)
Copy the current immutable object by replacing theoptionsmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the options map- Returns:
- A modified copy of
thisobject
-
withUsageIndex
public final ImmutableModule withUsageIndex(UsageIndex value)
Copy the current immutable object by setting a value for theusageIndexattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for usageIndex- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableModulethat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:name,protos,output,options,usageIndex.
-
toString
public String toString()
Prints the immutable valueModulewith attribute values.
-
copyOf
public static ImmutableModule copyOf(Module instance)
Creates an immutable copy of aModulevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Module instance
-
builder
public static ImmutableModule.Builder builder()
Creates a builder forImmutableModule.ImmutableModule.builder() .name(String) // requiredname.addProtos|addAllProtos(io.protostuff.compiler.model.Proto) //protoselements .output(String) // requiredoutput.putOptions|putAllOptions(String => Object) //optionsmappings .usageIndex(io.protostuff.compiler.model.UsageIndex) // requiredusageIndex.build();- Returns:
- A new ImmutableModule builder
-
-