本文整理汇总了Java中org.apache.jackrabbit.oak.api.PropertyState.getType方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyState.getType方法的具体用法?Java PropertyState.getType怎么用?Java PropertyState.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jackrabbit.oak.api.PropertyState
的用法示例。
在下文中一共展示了PropertyState.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public void serialize(PropertyState property) {
Type<?> type = property.getType();
if (!type.isArray()) {
serialize(property, type, 0);
} else {
Type<?> base = type.getBaseType();
int count = property.count();
if (base == STRING || count > 0) {
json.array();
for (int i = 0; i < count; i++) {
serialize(property, base, i);
}
json.endArray();
} else {
// type-safe encoding of an empty array
json.value(TypeCodes.EMPTY_ARRAY
+ PropertyType.nameFromValue(type.tag()));
}
}
}
示例2: toString
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
private static String toString(PropertyState ps) {
if (ps == null) {
return "<N/A>";
}
final Type type = ps.getType();
if (type.isArray()) {
return "<ARRAY>";
}
if (Type.BINARY == type) {
return "<BINARY>";
}
String value = ps.getValue(Type.STRING);
//Trim the value so as to not blowup diff message
if (Type.STRING == type && value.length() > 10) {
value = value.substring(0, 10) + "...";
}
return value;
}
示例3: equal
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
/**
* Checks whether the given two property states are equal. They are
* considered equal if their names and types match, they have an equal
* number of values, and each of the values is equal with the
* corresponding value in the other property.
*
* @param a first property state
* @param b second property state
* @return {@code true} if the properties are equal, {@code false} otherwise
*/
public static boolean equal(PropertyState a, PropertyState b) {
if (Objects.equal(a.getName(), b.getName())
&& Objects.equal(a.getType(), b.getType())) {
Type<?> type = a.getType();
if (a.isArray()) {
return a.count() == b.count()
&& Iterables.elementsEqual(
(Iterable<?>) a.getValue(type),
(Iterable<?>) b.getValue(type));
} else {
return Objects.equal(a.getValue(type), b.getValue(type));
}
} else {
return false;
}
}
示例4: getOakPrefixOrNull
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@CheckForNull
protected synchronized String getOakPrefixOrNull(String uri) {
if (uri.isEmpty()) {
return uri;
}
PropertyState mapping = nsdata.getProperty(encodeUri(uri));
if (mapping != null && mapping.getType() == STRING) {
return mapping.getValue(STRING);
}
return null;
}
示例5: getOakURIOrNull
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@CheckForNull
protected synchronized String getOakURIOrNull(String prefix) {
if (prefix.isEmpty()) {
return prefix;
}
PropertyState mapping = namespaces.getProperty(prefix);
if (mapping != null && mapping.getType() == STRING) {
return mapping.getValue(STRING);
}
return null;
}
示例6: getVersionLabels
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Nonnull
private Iterable<String> getVersionLabels(@Nonnull String historyRelPath, @Nonnull String versionId) throws CommitFailedException {
List<String> labels = new ArrayList<String>();
NodeBuilder labelNode = getVersionLabelsFor(historyRelPath);
for (PropertyState ps : labelNode.getProperties()) {
if (Type.REFERENCE == ps.getType()) {
if (versionId.equals(ps.getValue(Type.REFERENCE))) {
labels.add(ps.getName());
}
}
}
return labels;
}
示例7: Template
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
Template(NodeState state) {
PropertyState primary = null;
PropertyState mixins = null;
List<PropertyTemplate> templates = Lists.newArrayList();
for (PropertyState property : state.getProperties()) {
String name = property.getName();
Type<?> type = property.getType();
if ("jcr:primaryType".equals(name) && type == Type.NAME) {
primary = property;
} else if ("jcr:mixinTypes".equals(name) && type == Type.NAMES) {
mixins = property;
} else {
templates.add(new PropertyTemplate(property));
}
}
this.primaryType = primary;
this.mixinTypes = mixins;
this.properties =
templates.toArray(new PropertyTemplate[templates.size()]);
Arrays.sort(properties);
long count = state.getChildNodeCount(2);
if (count == 0) {
childName = ZERO_CHILD_NODES;
} else if (count == 1) {
childName = state.getChildNodeNames().iterator().next();
checkState(childName != null && !childName.equals(MANY_CHILD_NODES));
} else {
childName = MANY_CHILD_NODES;
}
}
示例8: getNamespaceURI
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static String getNamespaceURI(Tree root, String prefix) {
if (prefix.isEmpty()) {
return prefix;
}
if (isValidPrefix(prefix)) {
PropertyState property = getNamespaceTree(root).getProperty(prefix);
if (property != null && property.getType() == STRING) {
return property.getValue(STRING);
}
}
return null;
}
示例9: getString
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static String getString(NodeState state, String name) {
PropertyState property = state.getProperty(name);
if (property != null && property.getType() == STRING) {
return property.getValue(STRING);
} else {
return null;
}
}
示例10: getStrings
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static Iterable<String> getStrings(NodeState state, String name) {
PropertyState property = state.getProperty(name);
if (property != null && property.getType() == STRINGS) {
return property.getValue(STRINGS);
} else {
return emptyList();
}
}
示例11: getName
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
public static String getName(NodeState state, String name) {
PropertyState property = state.getProperty(name);
if (property != null && property.getType() == NAME) {
return property.getValue(NAME);
} else {
return null;
}
}
示例12: getDefinition
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Nonnull
@Override
public PropertyDefinition getDefinition(
Tree parent, PropertyState property, boolean exactTypeMatch)
throws RepositoryException {
Type<?> type = property.getType();
EffectiveNodeType effective = getEffectiveNodeType(parent);
return effective.getPropertyDefinition(
property.getName(), type.isArray(), type.tag(), exactTypeMatch);
}
示例13: getName
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@CheckForNull
public static String getName(Tree tree, String name) {
PropertyState property = tree.getProperty(name);
if (property != null && property.getType() == NAME) {
return property.getValue(NAME);
} else {
return null;
}
}
示例14: getNSData
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
private Iterable<String> getNSData(String name) {
PropertyState property = nsdata.getProperty(name);
if (property != null && property.getType() == STRINGS) {
return property.getValue(STRINGS);
} else {
return emptyList();
}
}
示例15: getBoolean
import org.apache.jackrabbit.oak.api.PropertyState; //导入方法依赖的package包/类
@Override
public boolean getBoolean(String name) {
PropertyState property = getProperty(name);
return property != null
&& property.getType() == BOOLEAN
&& property.getValue(BOOLEAN);
}