Skip to content

Commit 7d7c9b2

Browse files
author
nicolaiparlog
committed
Corrected nomenclature; the term "attribute" was replaced by "field".
1 parent a8fbedf commit 7d7c9b2

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* This package provides functionality around UI Controls. It might either provide additional functionality for existing
3-
* Swing or JavaFX controls or implement new ones.
2+
* This package provides functionality around UI Controls. Subpackages might provide additional functionality for
3+
* existing Swing or JavaFX controls, implement new ones or provide other features related to controls.
44
*/
55
package org.codefx.libfx.control;
66

src/main/java/org/codefx/libfx/control/properties/ControlPropertyListenerBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public ControlPropertyListener buildAndAttach() {
128128
* @return a {@link ControlPropertyListener}
129129
*/
130130
public ControlPropertyListener build() {
131-
checkAttributes();
131+
checkFields();
132132

133133
if (valueType.isPresent())
134134
return new TypeCheckingControlPropertyListener<T>(properties, key, valueType.get(), valueProcessor);
@@ -139,7 +139,7 @@ public ControlPropertyListener build() {
139139
/**
140140
* Checks whether the attributes are valid so they can be used to {@link #build()} a listener.
141141
*/
142-
private void checkAttributes() {
142+
private void checkFields() {
143143
if (key == null)
144144
throw new IllegalStateException("Set a key with 'forKey' before calling 'build'.");
145145
if (valueProcessor == null)

src/main/java/org/codefx/libfx/serialization/SerializableOptional.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
* <p>
1818
* The class can be used as an argument or return type for serialization-based RPC technologies like RMI.
1919
* <p>
20-
* There are three ways to use this class to serialize instances which have an optional attribute.
20+
* There are three ways to use this class to serialize instances which have an optional field.
2121
* <p>
22-
* <h2>Transform On Serialization</h2> The attribute can be declared as {@code transient Optional<T> optionalAttribute},
22+
* <h2>Transform On Serialization</h2> The field can be declared as {@code transient Optional<T> optionalField},
2323
* which will exclude it from serialization.
2424
* <p>
2525
* The class then needs to implement custom (de)serialization methods {@code writeObject} and {@code readObject}. They
26-
* must transform the {@code optionalAttribute} to a {@code SerializableOptional} when writing the object and after
26+
* must transform the {@code optionalField} to a {@code SerializableOptional} when writing the object and after
2727
* reading such an instance transform it back to an {@code Optional}.
2828
* <p>
2929
* <h3>Code Example</h3>
@@ -32,45 +32,45 @@
3232
* private void writeObject(ObjectOutputStream out) throws IOException {
3333
* out.defaultWriteObject();
3434
* out.writeObject(
35-
* SerializableOptional.fromOptional(optionalAttribute));
35+
* SerializableOptional.fromOptional(optionalField));
3636
* }
3737
*
3838
* private void readObject(ObjectInputStream in)
3939
* throws IOException, ClassNotFoundException {
4040
*
4141
* in.defaultReadObject();
42-
* optionalAttribute =
42+
* optionalField =
4343
* ((SerializableOptional<T>) in.readObject()).toOptional();
4444
* }
4545
* </pre>
4646
* <p>
4747
* <h2>Transform On Replace</h2> If the class is serialized using the Serialization Proxy Pattern (see <i>Effective
4848
* Java</i> by Joshua Bloch, Item 78), the proxy can have an instance of {@link SerializableOptional} to clearly denote
49-
* the attribute as being optional.
49+
* the field as being optional.
5050
* <p>
5151
* In this case, the proxy needs to transform the {@code Optional} to {@code SerializableOptional} in its constructor
5252
* (using {@link SerializableOptional#fromOptional(Optional)}) and the other way in {@code readResolve()} (with
5353
* {@link SerializableOptional#asOptional()}).
5454
* <p>
55-
* <h2>Transform On Access</h2> The attribute can be declared as {@code SerializableOptional<T> optionalAttribute}. This
55+
* <h2>Transform On Access</h2> The field can be declared as {@code SerializableOptional<T> optionalField}. This
5656
* will include it in the (de)serialization process so it does not need to be customized.
5757
* <p>
58-
* But methods interacting with the attribute need to get an {@code Optional} instead. This can easily be done by
59-
* writing the accessor methods such that they transform the attribute on each access.
58+
* But methods interacting with the field need to get an {@code Optional} instead. This can easily be done by writing
59+
* the accessor methods such that they transform the field on each access.
6060
* <p>
6161
* Note that {@link #asOptional()} simply returns the {@code Optional} which with this instance was created so no
6262
* constructor needs to be invoked.
6363
* <p>
64-
* <h3>Code Example</h3> Note that it is rarely useful to expose an optional attribute via accessor methods. Hence the
64+
* <h3>Code Example</h3> Note that it is rarely useful to expose an optional field via accessor methods. Hence the
6565
* following are private and for use inside the class.
6666
*
6767
* <pre>
68-
* private Optional<T> getOptionalAttribute() {
69-
* return optionalAttribute.asOptional();
68+
* private Optional<T> getOptionalField() {
69+
* return optionalField.asOptional();
7070
* }
7171
*
72-
* private void setOptionalAttribute(Optional<T> optionalAttribute) {
73-
* this.optionalAttribute = SerializableOptional.fromOptional(optionalAttribute);
72+
* private void setOptionalField(Optional<T> optionalField) {
73+
* this.optionalField = SerializableOptional.fromOptional(optionalField);
7474
* }
7575
* </pre>
7676
*
@@ -85,8 +85,7 @@ public final class SerializableOptional<T extends Serializable> implements Seria
8585
private static final long serialVersionUID = -652697447004597911L;
8686

8787
/**
88-
* The wrapped {@link Optional}. Note that this attribute is transient so it will not be (de)serializd
89-
* automatically.
88+
* The wrapped {@link Optional}. Note that this field is transient so it will not be (de)serializd automatically.
9089
*/
9190
private final Optional<T> optional;
9291

0 commit comments

Comments
 (0)