org.apache.openjpa.lib.conf.Value.getString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.apache.openjpa.lib.conf.Value.getString()方法的一些代码示例,展示了Value.getString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.getString()方法的具体详情如下:
包路径:org.apache.openjpa.lib.conf.Value
类名称:Value
方法名:getString

Value.getString介绍

[英]Return a stringified version of this value. If the current value has a short alias key, the alias key is returned.
[中]返回此值的字符串化版本。如果当前值具有短别名键,则返回别名键。

代码示例

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public int hashCode() {
  String str = (isDynamic()) ? getOriginalValue() : getString();
  int strHash = (str == null) ? 0 : str.hashCode();
  int propHash = (prop == null) ? 0 : prop.hashCode();
  return strHash ^ propHash;
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public int hashCode() {
  String str = (isDynamic()) ? getOriginalValue() : getString();
  int strHash = (str == null) ? 0 : str.hashCode();
  int propHash = (prop == null) ? 0 : prop.hashCode();
  return strHash ^ propHash;
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public int hashCode() {
  String str = (isDynamic()) ? getOriginalValue() : getString();
  int strHash = (str == null) ? 0 : str.hashCode();
  int propHash = (prop == null) ? 0 : prop.hashCode();
  return strHash ^ propHash;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public int hashCode() {
  String str = (isDynamic()) ? getOriginalValue() : getString();
  int strHash = (str == null) ? 0 : str.hashCode();
  int propHash = (prop == null) ? 0 : prop.hashCode();
  return strHash ^ propHash;
}

代码示例来源:origin: riptano/hector-jpa

/**
 * @return the cluster
 */
public Cluster getCluster() {
 if (cluster != null) {
  return cluster;
 }
 String clusterName = getValue(CLUSTER_NAME_PROP).getString();
 String clusterConnection = getValue(HOST_LIST_PROP).getString();
 cluster = HFactory.getOrCreateCluster(clusterName,
   new CassandraHostConfigurator(clusterConnection));
 return cluster;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public boolean equals(Object other) {
  if (other == this)
    return true;
  if (!(other instanceof Value))
    return false;
  Value o = (Value) other;
  String thisStr = (isDynamic()) ? getOriginalValue() : getString();
  String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString();
  return (isDynamic() == o.isDynamic())
    && Objects.equals(prop, o.getProperty())
    && Objects.equals(thisStr, thatStr);
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public boolean equals(Object other) {
  if (other == this)
    return true;
  if (!(other instanceof Value))
    return false;
  Value o = (Value) other;
  String thisStr = (isDynamic()) ? getOriginalValue() : getString();
  String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString();
  return (isDynamic() == o.isDynamic())
    && StringUtils.equals(prop, o.getProperty())
    && StringUtils.equals(thisStr, thatStr);
}

代码示例来源:origin: riptano/hector-jpa

/**
 * @return the indexingService
 */
public IndexingService getIndexingService() {
 if (indexingService != null) {
  return indexingService;
 }
 String className = getValue(INDEXING_PROP).getString();
 try {
  this.indexingService = (IndexingService) createInstance(className,
    SyncInMemoryIndexingService.class.getName());
 } catch (Exception e) {
  throw new UserException(String.format(
    "Unable to load class '%s' as an instance of %s", className,
    IndexingService.class), e);
 }
 this.indexingService.postCreate(this);
 return this.indexingService;
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public boolean equals(Object other) {
  if (other == this)
    return true;
  if (!(other instanceof Value))
    return false;
  Value o = (Value) other;
  String thisStr = (isDynamic()) ? getOriginalValue() : getString();
  String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString();
  return (isDynamic() == o.isDynamic())
    && Objects.equals(prop, o.getProperty())
    && Objects.equals(thisStr, thatStr);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Use {@link #getOriginalValue() original value} instead of 
 * {@link #getString() current value} because they are one and the same 
 * for non-dynamic Values and ensures that modifying dynamic Values do not
 * impact equality or hashCode contract.   
 */
public boolean equals(Object other) {
  if (other == this)
    return true;
  if (!(other instanceof Value))
    return false;
  Value o = (Value) other;
  String thisStr = (isDynamic()) ? getOriginalValue() : getString();
  String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString();
  return (isDynamic() == o.isDynamic())
    && StringUtils.equals(prop, o.getProperty())
    && StringUtils.equals(thisStr, thatStr);
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

public void valueChanged(Value val) {
  if (_changeSupport == null && _props == null)
    return;
  String newString = val.getString();
  if (_changeSupport != null)
    _changeSupport.firePropertyChange(val.getProperty(), null, newString);
  // keep cached props up to date
  if (_props != null) {
    if (newString == null)
      Configurations.removeProperty(val.getProperty(), _props);
    else if (Configurations.containsProperty(val, _props)
      || val.getDefault() == null
      || !val.getDefault().equals(newString))
      setValue(_props, val);
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

public void valueChanged(Value val) {
  if (_changeSupport == null && _props == null)
    return;
  String newString = val.getString();
  if (_changeSupport != null)
    _changeSupport.firePropertyChange(val.getProperty(), null, newString);
  // keep cached props up to date
  if (_props != null) {
    if (newString == null)
      Configurations.removeProperty(val.getProperty(), _props);
    else if (Configurations.containsProperty(val, _props)
      || val.getDefault() == null
      || !val.getDefault().equals(newString))
      setValue(_props, val);
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

public void valueChanged(Value val) {
  if (_changeSupport == null && _props == null)
    return;
  String newString = val.getString();
  if (_changeSupport != null)
    _changeSupport.firePropertyChange(val.getProperty(), null, newString);
  // keep cached props up to date
  if (_props != null) {
    if (newString == null)
      Configurations.removeProperty(val.getProperty(), _props);
    else if (Configurations.containsProperty(val, _props)
      || val.getDefault() == null
      || !val.getDefault().equals(newString))
      setValue(_props, val);
  }
}

代码示例来源:origin: riptano/hector-jpa

/**
 * @return the keyspace
 */
public Keyspace getKeyspace() {
 if (keyspace != null) {
  return keyspace;
 }
 keyspace = HFactory.createKeyspace(getValue(KEYSPACE_PROP).getString(),
   getCluster());
 keyspace.setConsistencyLevelPolicy(new JPAConsistencyPolicy());
 return keyspace;
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

public void valueChanged(Value val) {
  if (_changeSupport == null && _props == null)
    return;
  String newString = val.getString();
  if (_changeSupport != null)
    _changeSupport.firePropertyChange(val.getProperty(), null,
      newString);
  // keep cached props up to date
  if (_props != null) {
    if (newString == null)
      Configurations.removeProperty(val.getProperty(), _props);
    else if (Configurations.containsProperty(val.getProperty(), _props)
      || val.getDefault() == null
      || !val.getDefault().equals(newString))
      put(_props, val, newString);
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Set this value as an object.
 * <br>
 * If this Value is being set to a non-default value for the first time
 * (as designated by <code>originalString</code> being null), then the
 * value is remembered as <em>original</em>. This original value is used
 * for equality and hashCode computation if this Value is
 * {@link #isDynamic() dynamic}. 
 * 
 */
public void setObject(Object obj) {
  // if setting to null set as string to get defaults into play
  if (obj == null && def != null)
    setString(null);
  else {
    try {
      setInternalObject(obj);
      if (originalValue == null && obj != null && !isDefault(obj)) {
        originalValue = getString();
      }
    } catch (ParseException pe) {
      throw pe;
    } catch (RuntimeException re) {
      throw new ParseException(prop + ": " + obj, re);
    }
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Adds <code>o</code> to <code>map</code> under key for <code>val</code>.
 * Use this method instead of attempting to add the value directly because 
 * this will account for the property prefix.
 */
private void setValue(Map map, Value val) {
  Object key = val.getLoadKey();
  if (key == null) {
    List<String> keys = val.getPropertyKeys();
    for (String k : keys) {
      if (hasKnownPrefix(k)) {
        key = k;
        break;
      }
    }
    if (key == null) {
      key = "openjpa." + val.getProperty();
    }
  }
  Object external = val.isHidden() ? Value.INVISIBLE : 
    val instanceof ObjectValue ? val.getString() : val.get();
  map.put(key, external);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Adds <code>o</code> to <code>map</code> under key for <code>val</code>.
 * Use this method instead of attempting to add the value directly because 
 * this will account for the property prefix.
 */
private void setValue(Map map, Value val) {
  Object key = val.getLoadKey();
  if (key == null) {
    List<String> keys = val.getPropertyKeys();
    for (String k : keys) {
      if (hasKnownPrefix(k)) {
        key = k;
        break;
      }
    }
    if (key == null) {
      key = "openjpa." + val.getProperty();
    }
  }
  Object external = val.isHidden() ? Value.INVISIBLE : 
    val instanceof ObjectValue ? val.getString() : val.get();
  map.put(key, external);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Adds <code>o</code> to <code>map</code> under key for <code>val</code>.
 * Use this method instead of attempting to add the value directly because 
 * this will account for the property prefix.
 */
private void setValue(Map map, Value val) {
  Object key = val.getLoadKey();
  if (key == null) {
    List<String> keys = val.getPropertyKeys();
    for (String k : keys) {
      if (hasKnownPrefix(k)) {
        key = k;
        break;
      }
    }
    if (key == null) {
      key = "openjpa." + val.getProperty();
    }
  }
  Object external = val.isHidden() ? Value.INVISIBLE : 
    val instanceof ObjectValue ? val.getString() : val.get();
  map.put(key, external);
}

代码示例来源:origin: org.apache.openjpa/openjpa-lib

/**
 * Set this value from the given string. If the given string is null or
 * empty and a default is defined, the default is used. If the given
 * string(or default) is an alias key, it will be converted to the
 * corresponding value internally.
 * <br>
 * If this Value is being set to a non-default value for the first time
 * (as designated by <code>originalString</code> being null), then the
 * value is remembered as <em>original</em>. This original value is used
 * for equality and hashCode computation if this Value is
 * {@link #isDynamic() dynamic}. 
 *
 */
public void setString(String val) {
  assertChangeable();
  String str = unalias(val);
  try {
    setInternalString(str);
    if (originalValue == null && val != null && !isDefault(val)) {
      originalValue = getString();
    }
  } catch (ParseException pe) {
    throw pe;
  } catch (RuntimeException re) {
    throw new ParseException(prop + ": " + val, re);
  }
}

相关文章