You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2012/10/12 13:03:23 UTC
svn commit: r1397513 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
Author: mduerig
Date: Fri Oct 12 11:03:23 2012
New Revision: 1397513
URL: http://svn.apache.org/viewvc?rev=1397513&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
Javadoc, minor refactor
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java?rev=1397513&r1=1397512&r2=1397513&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryPropertyBuilder.java Fri Oct 12 11:03:23 2012
@@ -31,31 +31,67 @@ import org.apache.jackrabbit.oak.spi.sta
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
+/**
+ * {@code PropertyBuilder} for building in memory {@code PropertyState} instances.
+ * @param <T>
+ */
public class MemoryPropertyBuilder<T> implements PropertyBuilder<T> {
private final Type<T> type;
private String name;
private List<T> values = Lists.newArrayList();
+ /**
+ * Create a new instance for building {@code PropertyState} instances
+ * of the given {@code type}.
+ * @param type type of the {@code PropertyState} instances to be built.
+ * @throws IllegalArgumentException if {@code type.isArray()} is {@code true}.
+ */
public MemoryPropertyBuilder(Type<T> type) {
+ checkArgument(!type.isArray(), "type must not be array");
this.type = type;
}
+ /**
+ * Create a new instance for building {@code PropertyState} instances
+ * of the given {@code type}.
+ * @param type type of the {@code PropertyState} instances to be built.
+ * @return {@code PropertyBuilder} for {@code type}
+ */
public static <T> PropertyBuilder<T> create(Type<T> type) {
- checkArgument(!type.isArray(), "type must not be array");
return new MemoryPropertyBuilder<T>(type);
}
+ /**
+ * Create a new instance for building {@code PropertyState} instances
+ * of the given {@code type}. The builder is initialised with the name and
+ * the values of {@code property}.
+ * Equivalent to
+ * <pre>
+ * MemoryPropertyBuilder.create(type).assignFrom(property);
+ * </pre>
+ * @param type type of the {@code PropertyState} instances to be built.
+ * @param property initial name and values
+ * @return {@code PropertyBuilder} for {@code type}
+ */
public static <T> PropertyBuilder<T> create(Type<T> type, PropertyState property) {
- checkArgument(!type.isArray(), "type must not be array");
- return new MemoryPropertyBuilder<T>(type)
- .assignFrom(property);
+ return create(type).assignFrom(property);
}
+ /**
+ * Create a new instance for building {@code PropertyState} instances
+ * of the given {@code type}. The builder is initialised with the
+ * given {@code name}.
+ * Equivalent to
+ * <pre>
+ * MemoryPropertyBuilder.create(type).setName(name);
+ * </pre>
+ * @param type type of the {@code PropertyState} instances to be built.
+ * @param name initial name
+ * @return {@code PropertyBuilder} for {@code type}
+ */
public static <T> PropertyBuilder<T> create(Type<T> type, String name) {
- checkArgument(!type.isArray(), "type must not be array");
- return new MemoryPropertyBuilder<T>(type)
- .setName(name);
+ return create(type).setName(name);
}
@Override