本文整理了Java中org.apache.tika.metadata.Property.getPrimaryProperty()
方法的一些代码示例,展示了Property.getPrimaryProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getPrimaryProperty()
方法的具体详情如下:
包路径:org.apache.tika.metadata.Property
类名称:Property
方法名:getPrimaryProperty
[英]Gets the primary property for a composite property
[中]获取复合属性的主属性
代码示例来源:origin: apache/tika
/**
* Sets the real or rational value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple real or simple rational property definition
* @param value property value
*/
public void set(Property property, double value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.REAL &&
property.getPrimaryProperty().getValueType() != Property.ValueType.RATIONAL) {
throw new PropertyTypeException(Property.ValueType.REAL, property.getPrimaryProperty().getValueType());
}
set(property, Double.toString(value));
}
代码示例来源:origin: apache/tika
/**
* Sets the integer value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param value property value
*/
public void set(Property property, int value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.INTEGER) {
throw new PropertyTypeException(Property.ValueType.INTEGER, property.getPrimaryProperty().getValueType());
}
set(property, Integer.toString(value));
}
代码示例来源:origin: apache/tika
/**
* Returns the value of the identified Integer based metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @return property value as a Integer, or <code>null</code> if the property is not set, or not a valid Integer
*/
public Integer getInt(Property property) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
return null;
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.INTEGER) {
return null;
}
String v = get(property);
if(v == null) {
return null;
}
try {
return Integer.valueOf(v);
} catch(NumberFormatException e) {
return null;
}
}
代码示例来源:origin: apache/tika
/**
* Sets the date value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param date property value
*/
public void set(Property property, Date date) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
throw new PropertyTypeException(Property.ValueType.DATE, property.getPrimaryProperty().getValueType());
}
String dateString = null;
if (date != null) {
dateString = formatDate(date);
}
set(property, dateString);
}
代码示例来源:origin: apache/tika
/**
* Sets the date value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param date property value
*/
public void set(Property property, Calendar date) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
throw new PropertyTypeException(Property.ValueType.DATE, property.getPrimaryProperty().getValueType());
}
String dateString = null;
if (date != null) {
dateString = formatDate(date);
}
set(property, dateString);
}
代码示例来源:origin: apache/tika
/**
* Returns the value of the identified Date based metadata property.
*
* @since Apache Tika 0.8
* @param property simple date property definition
* @return property value as a Date, or <code>null</code> if the property is not set, or not a valid Date
*/
public Date getDate(Property property) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
return null;
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
return null;
}
String v = get(property);
if (v != null) {
return parseDate(v);
} else {
return null;
}
}
代码示例来源:origin: apache/tika
/**
* Sets the values of the identified metadata property.
*
* @since Apache Tika 1.2
* @param property property definition
* @param values property values
*/
public void set(Property property, String[] values) {
if (property == null) {
throw new NullPointerException("property must not be null");
}
if (property.getPropertyType() == PropertyType.COMPOSITE) {
set(property.getPrimaryProperty(), values);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
set(secondaryExtractProperty, values);
}
}
} else {
metadata.put(property.getName(), values);
}
}
代码示例来源:origin: apache/tika
/**
* Sets the value of the identified metadata property.
*
* @since Apache Tika 0.7
* @param property property definition
* @param value property value
*/
public void set(Property property, String value) {
if (property == null) {
throw new NullPointerException("property must not be null");
}
if (property.getPropertyType() == PropertyType.COMPOSITE) {
set(property.getPrimaryProperty(), value);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
set(secondaryExtractProperty, value);
}
}
} else {
set(property.getName(), value);
}
}
代码示例来源:origin: apache/tika
add(property.getPrimaryProperty(), value);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
代码示例来源:origin: apache/tika
/**
* Sets array properties. If the property already exists, it is overwritten. Only array
* properties that use a registered prefix are stored in the XMP.
*
* @see org.apache.tika.metadata.Metadata#set(org.apache.tika.metadata.Property,
* java.lang.String[])
*/
@Override
public void set(Property property, String[] values) {
checkKey( property.getName() );
if (!property.isMultiValuePermitted()) {
throw new PropertyTypeException( "Property is not of an array type" );
}
String[] keyParts = splitKey( property.getName() );
String ns = registry.getNamespaceURI( keyParts[0] );
if (ns != null) {
try {
int arrayType = tikaToXMPArrayType( property.getPrimaryProperty().getPropertyType() );
xmpData.setProperty( ns, keyParts[1], null, new PropertyOptions( arrayType ) );
for (String value : values) {
xmpData.appendArrayItem( ns, keyParts[1], value );
}
}
catch (XMPException e) {
// Ignore
}
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Sets the integer value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param value property value
*/
public void set(Property property, int value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.INTEGER) {
throw new PropertyTypeException(Property.ValueType.INTEGER, property.getPrimaryProperty().getValueType());
}
set(property, Integer.toString(value));
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Sets the real or rational value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple real or simple rational property definition
* @param value property value
*/
public void set(Property property, double value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.REAL &&
property.getPrimaryProperty().getValueType() != Property.ValueType.RATIONAL) {
throw new PropertyTypeException(Property.ValueType.REAL, property.getPrimaryProperty().getValueType());
}
set(property, Double.toString(value));
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Sets the real or rational value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple real or simple rational property definition
* @param value property value
*/
public void set(Property property, double value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.REAL &&
property.getPrimaryProperty().getValueType() != Property.ValueType.RATIONAL) {
throw new PropertyTypeException(Property.ValueType.REAL, property.getPrimaryProperty().getValueType());
}
set(property, Double.toString(value));
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Sets the integer value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param value property value
*/
public void set(Property property, int value) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.INTEGER) {
throw new PropertyTypeException(Property.ValueType.INTEGER, property.getPrimaryProperty().getValueType());
}
set(property, Integer.toString(value));
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Sets the date value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param date property value
*/
public void set(Property property, Date date) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
throw new PropertyTypeException(Property.ValueType.DATE, property.getPrimaryProperty().getValueType());
}
String dateString = null;
if (date != null) {
dateString = formatDate(date);
}
set(property, dateString);
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Returns the value of the identified Date based metadata property.
*
* @since Apache Tika 0.8
* @param property simple date property definition
* @return property value as a Date, or <code>null</code> if the property is not set, or not a valid Date
*/
public Date getDate(Property property) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
return null;
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
return null;
}
String v = get(property);
if (v != null) {
return parseDate(v);
} else {
return null;
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Sets the date value of the identified metadata property.
*
* @since Apache Tika 0.8
* @param property simple integer property definition
* @param date property value
*/
public void set(Property property, Calendar date) {
if(property.getPrimaryProperty().getPropertyType() != Property.PropertyType.SIMPLE) {
throw new PropertyTypeException(Property.PropertyType.SIMPLE, property.getPrimaryProperty().getPropertyType());
}
if(property.getPrimaryProperty().getValueType() != Property.ValueType.DATE) {
throw new PropertyTypeException(Property.ValueType.DATE, property.getPrimaryProperty().getValueType());
}
String dateString = null;
if (date != null) {
dateString = formatDate(date);
}
set(property, dateString);
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Sets the values of the identified metadata property.
*
* @since Apache Tika 1.2
* @param property property definition
* @param values property values
*/
public void set(Property property, String[] values) {
if (property == null) {
throw new NullPointerException("property must not be null");
}
if (property.getPropertyType() == PropertyType.COMPOSITE) {
set(property.getPrimaryProperty(), values);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
set(secondaryExtractProperty, values);
}
}
} else {
metadata.put(property.getName(), values);
}
}
代码示例来源:origin: org.apache.tika/tika-core
/**
* Sets the value of the identified metadata property.
*
* @since Apache Tika 0.7
* @param property property definition
* @param value property value
*/
public void set(Property property, String value) {
if (property == null) {
throw new NullPointerException("property must not be null");
}
if (property.getPropertyType() == PropertyType.COMPOSITE) {
set(property.getPrimaryProperty(), value);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
set(secondaryExtractProperty, value);
}
}
} else {
set(property.getName(), value);
}
}
代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-core
/**
* Sets the value of the identified metadata property.
*
* @since Apache Tika 0.7
* @param property property definition
* @param value property value
*/
public void set(Property property, String value) {
if (property == null) {
throw new NullPointerException("property must not be null");
}
if (property.getPropertyType() == PropertyType.COMPOSITE) {
set(property.getPrimaryProperty(), value);
if (property.getSecondaryExtractProperties() != null) {
for (Property secondaryExtractProperty : property.getSecondaryExtractProperties()) {
set(secondaryExtractProperty, value);
}
}
} else {
set(property.getName(), value);
}
}
内容来源于网络,如有侵权,请联系作者删除!