lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType > Class Template Referenceabstract

An abstract base class for target properties. More...

Public Member Functions

Optional< Element > astElementFromConfig (TargetConfig config)
boolean checkType (KeyValuePair pair, MessageReporter reporter)
 If the given key-value pair does not match the type required by this target property, report an error through the given reporter.
boolean equals (Object obj)
 Return true if the given object is an instance of a class with the same name.
int hashCode ()
abstract T initialValue ()
 Return the initial value to assign to this target property.
boolean loadFromFederate ()
 Return true if this property is to be loaded from imported federates, false otherwise.
boolean loadFromFederation ()
 Return true if this property is to be loaded by federates when specified at the level of the federation, false otherwise.
boolean loadFromImport ()
 Return true if this property is to be loaded from imported files, false otherwise.
abstract String name ()
 Return the name of this target property (in kebab case).
final void override (TargetConfig config, T value)
 Replace the value assigned to this target property in the given config with the given value.
abstract Element toAstElement (T value)
 Return an AST node that represents this target property and the value currently assigned to it.
String toString ()
final void update (TargetConfig config, JsonElement element, MessageReporter reporter)
 Update the given configuration based on the given JSON element.
final void update (TargetConfig config, KeyValuePair pair, MessageReporter reporter)
 Update the given configuration based on the given corresponding AST node.
void update (TargetConfig config, T value)
 Update the given configuration using the given value.
void validate (TargetConfig config, MessageReporter reporter)
 Override this method to implement additional checks.

Public Attributes

final S type
 The type of values assignable to this target property.

Protected Member Functions

abstract T fromAst (Element node, MessageReporter reporter)
 Given an AST node, produce a corresponding value that is assignable to this target property, or report an error via the given reporter in case any problems are encountered.
fromJSON (JsonElement element, MessageReporter reporter)
 Return a value based on the given JSON element.
abstract T fromString (String string, MessageReporter reporter)
 Given a string, produce a corresponding value that is assignable to this target property, or report an error via the given reporter in case any problems are encountered.
 TargetProperty (S type)
 Construct a new target property.

Detailed Description

An abstract base class for target properties.

Parameters
<T>The Java type of the value assigned to the target property.
<S>The LF type of the value assigned to the target property.
Author
Marten Lohstroh

Constructor & Destructor Documentation

◆ TargetProperty()

org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.TargetProperty ( S type)
protected

Construct a new target property.

Parameters
typeThe type of the value that can be assigned to the property.

Member Function Documentation

◆ astElementFromConfig()

Optional< Element > org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.astElementFromConfig ( TargetConfig config)

◆ checkType()

boolean org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.checkType ( KeyValuePair pair,
MessageReporter reporter )

If the given key-value pair does not match the type required by this target property, report an error through the given reporter.

Parameters
pairThe ast node that matches this target property.
reporterThe reporter to issue an error through if the given key-value pair does not match the type required by this property.

◆ equals()

boolean org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.equals ( Object obj)

Return true if the given object is an instance of a class with the same name.

Parameters
objThe object to compare this instance to.

◆ fromAst()

abstract T org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.fromAst ( Element node,
MessageReporter reporter )
abstractprotected

Given an AST node, produce a corresponding value that is assignable to this target property, or report an error via the given reporter in case any problems are encountered.

Parameters
nodeThe AST node to derive a value of type T from.
reporterA reporter for reporting errors.
Returns
A value of type T.

◆ fromJSON()

T org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.fromJSON ( JsonElement element,
MessageReporter reporter )
protected

Return a value based on the given JSON element.

Parameters
elementThe JSON element to produce a value from/
reporterA message reporter for reporting issues.

◆ fromString()

abstract T org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.fromString ( String string,
MessageReporter reporter )
abstractprotected

Given a string, produce a corresponding value that is assignable to this target property, or report an error via the given reporter in case any problems are encountered.

Parameters
stringThe string to derive a value of type T from.
reporterA reporter for reporting errors.
Returns
A value of type T.

◆ hashCode()

◆ initialValue()

abstract T org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.initialValue ( )
abstract

Return the initial value to assign to this target property.

◆ loadFromFederate()

boolean org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.loadFromFederate ( )

Return true if this property is to be loaded from imported federates, false otherwise.

◆ loadFromFederation()

boolean org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.loadFromFederation ( )

Return true if this property is to be loaded by federates when specified at the level of the federation, false otherwise.

◆ loadFromImport()

boolean org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.loadFromImport ( )

Return true if this property is to be loaded from imported files, false otherwise.

◆ name()

abstract String org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.name ( )
abstract

Return the name of this target property (in kebab case).

◆ override()

final void org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.override ( TargetConfig config,
T value )

Replace the value assigned to this target property in the given config with the given value.

Parameters
configThe configuration to change.
valueThe new value to assign.

◆ toAstElement()

abstract Element org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.toAstElement ( T value)
abstract

Return an AST node that represents this target property and the value currently assigned to it.

◆ toString()

◆ update() [1/3]

final void org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.update ( TargetConfig config,
JsonElement element,
MessageReporter reporter )

Update the given configuration based on the given JSON element.

Parameters
configThe configuration to update.
elementThe JSON element that holds the value to perform the update with.
reporterA reporter to report issues.

◆ update() [2/3]

final void org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.update ( TargetConfig config,
KeyValuePair pair,
MessageReporter reporter )

Update the given configuration based on the given corresponding AST node.

If the given configuration does not belong in the AST, then report an error using the error message given by TargetConfig.NOT_IN_LF_SYNTAX_MESSAGE.

Parameters
configThe configuration to update.
pairThe pair that holds the value to perform the update with.
reporterA reporter to report issues.

◆ update() [3/3]

void org.lflang.target.property.TargetProperty< T, S extends TargetPropertyType >.update ( TargetConfig config,
T value )

Update the given configuration using the given value.

The default implementation simply assigns the given value, overriding whatever value might have been assigned before.

Parameters
configThe configuration to update.
valueThe value to perform the update with.

◆ validate()

Override this method to implement additional checks.

The base implementation does nothing.

This method is meant to perform additional validation above and beyond checking target support and type checking which are done automatically.

Parameters
configThe target configuration to check against.
reporterA reporter for reporting errors.

Member Data Documentation

◆ type

The type of values assignable to this target property.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/target/property/TargetProperty.java