Skip to content

Commit 372b27b

Browse files
author
tgardner1959
committed
Many changes and reformattings
1 parent 73fef1a commit 372b27b

90 files changed

Lines changed: 1603 additions & 1465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/samplecode/add/AddExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Demonstrates the {@link AddRequest}; this example uses a hard coded
2525
* hostname of {@code ldap-server.ldap.com} and port {@code 389} and
26-
* attempts to add {@code uid=user,dc=example,dc=com}.
26+
* uses the test utilities class to generate an entry to add.
2727
*/
2828
public final class AddExample {
2929

src/main/java/samplecode/annotation/Author.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* should have received a copy of the GNU General Public License along
1414
* with this program; if not, see <http://www.gnu.org/licenses>.
1515
*/
16+
1617
package samplecode.annotation;
1718

1819

@@ -25,9 +26,9 @@
2526
/**
2627
* Associates an author with a type.
2728
*/
28-
@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
29-
public @interface Author
30-
{
29+
@Retention(RetentionPolicy.RUNTIME)
30+
@Target(ElementType.TYPE)
31+
public @interface Author {
3132

3233
/**
3334
* The author's name

src/main/java/samplecode/annotation/CodeVersion.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* should have received a copy of the GNU General Public License along
1414
* with this program; if not, see <http://www.gnu.org/licenses>.
1515
*/
16+
1617
package samplecode.annotation;
1718

1819

@@ -25,9 +26,9 @@
2526
/**
2627
* Annotates the version of a type.
2728
*/
28-
@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
29-
public @interface CodeVersion
30-
{
29+
@Retention(RetentionPolicy.RUNTIME)
30+
@Target(ElementType.TYPE)
31+
public @interface CodeVersion {
3132

3233
/**
3334
* @return The version

src/main/java/samplecode/annotation/Launchable.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* should have received a copy of the GNU General Public License along
1414
* with this program; if not, see <http://www.gnu.org/licenses>.
1515
*/
16+
1617
package samplecode.annotation;
1718

1819

@@ -24,9 +25,10 @@
2425
* Marks a type as Launchable, that is, a type has a
2526
* {@code public static void mainString... args)} method.
2627
*/
27-
@Author("terry.gardner@unboundid.com") @Retention(RetentionPolicy.RUNTIME) @Since("1.2")
28-
public @interface Launchable
29-
{
28+
@Author("terry.gardner@unboundid.com")
29+
@Retention(RetentionPolicy.RUNTIME)
30+
@Since("1.2")
31+
public @interface Launchable {
3032
// This block deliberately left empty.
3133

3234
}

src/main/java/samplecode/annotation/Since.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* should have received a copy of the GNU General Public License along
1414
* with this program; if not, see <http://www.gnu.org/licenses>.
1515
*/
16+
1617
package samplecode.annotation;
1718

1819

@@ -24,9 +25,9 @@
2425
* Provides an annotation of a component indicating when the component
2526
* was first created, or first appeared in a particular version.
2627
*/
27-
@Author("terry.gardner@unboundid.com") @Retention(RetentionPolicy.RUNTIME)
28-
public @interface Since
29-
{
28+
@Author("terry.gardner@unboundid.com")
29+
@Retention(RetentionPolicy.RUNTIME)
30+
public @interface Since {
3031

3132
/**
3233
* The first appearance of the component.

src/main/java/samplecode/annotation/Singleton.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* should have received a copy of the GNU General Public License along
1414
* with this program; if not, see <http://www.gnu.org/licenses>.
1515
*/
16+
1617
package samplecode.annotation;
1718

1819

@@ -25,9 +26,11 @@
2526
/**
2627
* Marks a type as a singleton.
2728
*/
28-
@Author("terry.gardner@unboundid.com") @Since("Dec 29, 2011") @CodeVersion("1.1")
29-
@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME)
30-
public @interface Singleton
31-
{
29+
@Author("terry.gardner@unboundid.com")
30+
@Since("Dec 29, 2011")
31+
@CodeVersion("1.1")
32+
@Target(ElementType.TYPE)
33+
@Retention(RetentionPolicy.RUNTIME)
34+
public @interface Singleton {
3235
// This block deliberately left empty.
3336
}

src/main/java/samplecode/args/BooleanPropertiesBackedArgument.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,28 @@
3030
* an {@link Boolean}.
3131
*/
3232
public class BooleanPropertiesBackedArgument
33-
extends PropertiesBackedArgument<BooleanArgument,Boolean> {
34-
33+
extends PropertiesBackedArgument<BooleanArgument,Boolean> {
3534

3635

3736
private BooleanPropertiesBackedArgument(
38-
final ResourceBundle resourceBundle, final String basePropertyName) {
37+
final ResourceBundle resourceBundle, final String basePropertyName) {
3938
super(resourceBundle,basePropertyName);
4039
}
4140

4241

4342

4443
/**
4544
* @param resourceBundle
46-
* the resource bundle from which the command line argument
47-
* are taken
45+
* the resource bundle from which the command line argument
46+
* are taken
4847
* @param basePropertyName
49-
* the base property name
48+
* the base property name
5049
*
5150
* @return a new {@code StringPropertiesBackedArgument} object.
5251
*/
5352
public static BooleanPropertiesBackedArgument
54-
newBooleanPropertiesBackedArgument(
55-
final ResourceBundle resourceBundle, final String basePropertyName) {
53+
newBooleanPropertiesBackedArgument(
54+
final ResourceBundle resourceBundle, final String basePropertyName) {
5655
return new BooleanPropertiesBackedArgument(resourceBundle,basePropertyName);
5756
}
5857

@@ -70,16 +69,11 @@ protected Boolean convertString(final String value) {
7069

7170

7271

73-
74-
75-
76-
7772
@Override
7873
public BooleanArgument getArgument() throws ArgumentException {
7974
return new BooleanArgument(getShortIdentifier(),getLongIdentifier(),
80-
getMaxOccurrences(),getDescription());
75+
getMaxOccurrences(),getDescription());
8176
}
8277

8378

84-
8579
}

src/main/java/samplecode/args/FilterPropertiesBackedArgument.java

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,64 @@
88

99
import java.util.ResourceBundle;
1010

11+
1112
/**
1213
* Provide support for a {@link PropertiesBackedArgument} whose value is
1314
* an {@link Filter}.
1415
*/
1516
public class FilterPropertiesBackedArgument
16-
extends PropertiesBackedArgument<FilterArgument, Filter>
17-
{
17+
extends PropertiesBackedArgument<FilterArgument,Filter> {
1818

1919
/**
20-
* @param resourceBundle the resource bundle from which the command line argument
21-
* are taken
22-
* @param basePropertyName the base property name
20+
* @param resourceBundle
21+
* the resource bundle from which the command line argument
22+
* are taken
23+
* @param basePropertyName
24+
* the base property name
25+
*
2326
* @return a new {@code StringPropertiesBackedArgument} object.
2427
*/
2528
public static FilterPropertiesBackedArgument newFilterPropertiesBackedArgument(
26-
final ResourceBundle resourceBundle, final String basePropertyName)
27-
{
28-
return new FilterPropertiesBackedArgument(resourceBundle, basePropertyName);
29+
final ResourceBundle resourceBundle, final String basePropertyName) {
30+
return new FilterPropertiesBackedArgument(resourceBundle,basePropertyName);
2931
}
3032

33+
34+
3135
private FilterPropertiesBackedArgument(final ResourceBundle resourceBundle,
32-
final String basePropertyName)
33-
{
34-
super(resourceBundle, basePropertyName);
36+
final String basePropertyName) {
37+
super(resourceBundle,basePropertyName);
3538
}
3639

40+
41+
3742
/**
3843
* @return the {@code value} as an {@link Filter}.
3944
*/
4045
@Override
41-
protected Filter convertString(final String value)
42-
{
46+
protected Filter convertString(final String value) {
4347
Validator.ensureNotNull(value);
4448
Filter filter;
45-
try
46-
{
49+
try {
4750
filter = Filter.create(value);
48-
}
49-
catch(final LDAPException exception)
50-
{
51+
} catch(final LDAPException exception) {
5152
filter = null;
5253
}
5354
return filter;
5455
}
5556

57+
58+
5659
@Override
57-
public FilterArgument getArgument() throws ArgumentException
58-
{
60+
public FilterArgument getArgument() throws ArgumentException {
5961
final Character shortIdentifier = getShortIdentifier();
6062
final String longIdentifier = getLongIdentifier();
6163
final boolean isRequired = isRequired();
6264
final int maxOccurrences = getMaxOccurrences();
6365
final String valuePlaceholder = getValuePlaceholder();
6466
final String description = getDescription();
65-
return new FilterArgument(shortIdentifier, longIdentifier, isRequired, maxOccurrences,
66-
valuePlaceholder, description);
67+
return new FilterArgument(shortIdentifier,longIdentifier,isRequired,maxOccurrences,
68+
valuePlaceholder,description);
6769
}
6870

6971
}

src/main/java/samplecode/args/IntegerPropertiesBackedArgument.java

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.unboundid.util.args.ArgumentException;
66
import com.unboundid.util.args.IntegerArgument;
77

8-
98
import java.util.MissingResourceException;
109
import java.util.ResourceBundle;
1110

@@ -15,89 +14,78 @@
1514
* an {@link Integer}.
1615
*/
1716
public class IntegerPropertiesBackedArgument
18-
extends PropertiesBackedArgument<IntegerArgument,Integer>
19-
{
20-
17+
extends PropertiesBackedArgument<IntegerArgument,Integer> {
2118

2219

2320
/**
2421
* @param resourceBundle
25-
* the resource bundle from which the command line argument
26-
* are taken
27-
*
22+
* the resource bundle from which the command line argument
23+
* are taken
2824
* @param basePropertyName
29-
* the base property name
30-
*
25+
* the base property name
26+
*
3127
* @return a new {@code StringPropertiesBackedArgument} object.
3228
*/
3329
public static IntegerPropertiesBackedArgument newIntegerPropertiesBackedArgument(
34-
final ResourceBundle resourceBundle,final String basePropertyName)
35-
{
30+
final ResourceBundle resourceBundle, final String basePropertyName) {
3631
return new IntegerPropertiesBackedArgument(resourceBundle,basePropertyName);
3732
}
3833

3934

4035

4136
@Override
42-
public IntegerArgument getArgument() throws ArgumentException
43-
{
37+
public IntegerArgument getArgument() throws ArgumentException {
4438
/*
4539
* Construct an IntegerArgument using the provided information - and
4640
* use the upper bound and lower bound if provided.
4741
*/
4842
IntegerArgument arg;
49-
try
50-
{
43+
try {
5144
final int lowerBound = getLowerBound().intValue();
5245
final int upperBound = getUpperBound().intValue();
5346
arg =
54-
new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(),
55-
getMaxOccurrences(),getValuePlaceholder(),getDescription(),lowerBound,
56-
upperBound,getDefaultValue());
57-
}
58-
catch(final MissingResourceException ex)
59-
{
47+
new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(),
48+
getMaxOccurrences(),getValuePlaceholder(),getDescription(),lowerBound,
49+
upperBound,getDefaultValue());
50+
} catch(final MissingResourceException ex) {
6051
arg =
61-
new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(),
62-
getMaxOccurrences(),getValuePlaceholder(),getDescription(),
63-
getDefaultValue());
52+
new IntegerArgument(getShortIdentifier(),getLongIdentifier(),isRequired(),
53+
getMaxOccurrences(),getValuePlaceholder(),getDescription(),
54+
getDefaultValue());
6455
}
6556

6657
return arg;
6758
}
6859

6960

7061

71-
/** @return the {@code value} as an {@link Integer}. */
62+
/**
63+
* @return the {@code value} as an {@link Integer}.
64+
*/
7265
@Override
73-
protected Integer convertString(final String value)
74-
{
66+
protected Integer convertString(final String value) {
7567
Validator.ensureNotNull(value);
7668
return Integer.valueOf(value);
7769
}
7870

7971

8072

81-
private Integer getLowerBound() throws MissingResourceException
82-
{
73+
private Integer getLowerBound() throws MissingResourceException {
8374
return Integer.valueOf(getResourceBundle().getString(getBasePropertyName() + "LowerBound"));
8475
}
8576

8677

8778

88-
private Integer getUpperBound() throws MissingResourceException
89-
{
79+
private Integer getUpperBound() throws MissingResourceException {
9080
return Integer.valueOf(getResourceBundle().getString(getBasePropertyName() + "UpperBound"));
9181
}
9282

9383

9484

9585
private IntegerPropertiesBackedArgument(
96-
final ResourceBundle resourceBundle,final String basePropertyName)
97-
{
86+
final ResourceBundle resourceBundle, final String basePropertyName) {
9887
super(resourceBundle,basePropertyName);
9988
}
10089

10190

102-
10391
}

0 commit comments

Comments
 (0)