com.aegisql.conveyor.config.PersistenceProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of conveyor-configurator Show documentation
Show all versions of conveyor-configurator Show documentation
Conveyor Configurator and Factory
package com.aegisql.conveyor.config;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.regex.Pattern;
// TODO: Auto-generated Javadoc
/**
* The Class PersistenceProperty.
*/
public class PersistenceProperty {
/** The is persistence property. */
private final boolean isPersistenceProperty;
/** The is default property. */
private final boolean isDefaultProperty;
/** The type. */
private final String type;
/** The schema. */
private final String schema;
/** The name. */
private final String name;
/** The property. */
private final String property;
/** The value. */
private final Object value;
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("PersistenceProperty [");
return "PersistenceProperty [isPersistenceProperty=" + isPersistenceProperty + ", isDefaultProperty="
+ isDefaultProperty + ", " + (name != null ? "name=" + name + ", " : "")
+ (property != null ? "property=" + property : "") + "]";
}
/**
* Checks if is persistence property.
*
* @return true, if is persistence property
*/
public boolean isPersistenceProperty() {
return isPersistenceProperty;
}
/**
* Checks if is default property.
*
* @return true, if is default property
*/
public boolean isDefaultProperty() {
return isDefaultProperty;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets the property.
*
* @return the property
*/
public String getProperty() {
return property;
}
/**
* Instantiates a new persistence property.
*
* @param isConveyorProperty the is conveyor property
* @param isDefaultProperty the is default property
* @param type the type
* @param schema the schema
* @param name the name
* @param property the property
* @param value the value
*/
private PersistenceProperty(boolean isConveyorProperty, boolean isDefaultProperty, String type, String schema,
String name, String property, Object value) {
this.isPersistenceProperty = isConveyorProperty;
this.isDefaultProperty = isDefaultProperty;
this.name = name;
this.property = property;
this.value = value;
this.type = type;
this.schema = schema;
}
/**
* Eval.
*
* @param propertyKey the property key
* @param value the value
* @param consumer the consumer
*/
public static void eval(String propertyKey, Object value, Consumer consumer) {
if (propertyKey == null
|| !propertyKey.toUpperCase().startsWith(ConveyorConfiguration.PERSISTENCE_PREFIX.toUpperCase())) {
return;
}
if (value == null) {
PersistenceProperty cp = evalProperty(propertyKey, value);
consumer.accept(cp);
} else if (value instanceof Map) {
Map map = (Map) value;
map.forEach(
(part, val) -> eval(propertyKey + ConveyorConfiguration.PROPERTY_DELIMITER + part, val, consumer));
} else if (value instanceof List) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy