Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jackrabbit.oak.plugins.memory;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Nonnull;
import javax.jcr.PropertyType;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Type;
/**
* {@code PropertyBuilder} for building in memory {@code PropertyState} instances.
* @param
*/
public class PropertyBuilder {
private final Type type;
private String name;
private boolean isArray;
private List 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 PropertyBuilder(Type type) {
checkArgument(!type.isArray(), "type must not be array");
this.type = type;
}
/**
* Create a new instance for building scalar {@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 PropertyBuilder scalar(Type type) {
return new PropertyBuilder(type);
}
/**
* Create a new instance for building array {@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 PropertyBuilder array(Type type) {
return new PropertyBuilder(type).setArray();
}
/**
* Create a new instance for building scalar {@code PropertyState} instances
* of the given {@code type}. The builder is initialised with the
* given {@code name}.
* Equivalent to
*
* @param type type of the {@code PropertyState} instances to be built.
* @param name initial name
* @return {@code PropertyBuilder} for {@code type}
*/
public static PropertyBuilder scalar(Type type, String name) {
return scalar(type).setName(name);
}
/**
* Create a new instance for building array {@code PropertyState} instances
* of the given {@code type}. The builder is initialised with the
* given {@code name}.
* Equivalent to
*
* @param type type of the {@code PropertyState} instances to be built.
* @param name initial name
* @return {@code PropertyBuilder} for {@code type}
*/
public static PropertyBuilder array(Type type, String name) {
return scalar(type).setName(name).setArray();
}
/**
* 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
*