Codota Logo
MetaProperty
Code IndexAdd Codota to your IDE (free)

How to use
MetaProperty
in
org.joda.beans

Best Java code snippets using org.joda.beans.MetaProperty (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: OpenGamma/Strata

@Override
public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {
 try {
  return metaBean.metaProperty(propertyName);
 } catch (NoSuchElementException ex) {
  if (HOLIDAYS.name().equals(propertyName)) {
   return HOLIDAYS;
  }
  if (WEEKEND_DAYS.name().equals(propertyName)) {
   return WEEKEND_DAYS;
  }
  throw ex;
 }
}
origin: OpenGamma/Strata

@Override
public <R> Property<R> property(String propertyName) {
 return metaBean().<R>metaProperty(propertyName).createProperty(this);
}
origin: OpenGamma/Strata

private Set<String> fieldValues(Object object) {
 if (!(object instanceof Bean)) {
  return ImmutableSet.of();
 }
 Bean bean = (Bean) object;
 return bean.propertyNames().stream()
   .map(bean::property)
   .filter(p -> SUPPORTED_FIELD_TYPES.contains(p.metaProperty().propertyType()))
   .map(Property::get)
   .filter(v -> v != null)
   .map(Object::toString)
   .map(v -> v.toLowerCase(Locale.ENGLISH))
   .collect(toImmutableSet());
}
origin: OpenGamma/Strata

@Override
public EvaluationResult evaluate(
  Position position,
  CalculationFunctions functions,
  String firstToken,
  List<String> remainingTokens) {
 MetaBean metaBean = MetaBean.of(position.getClass());
 // position
 Optional<String> positionPropertyName = metaBean.metaPropertyMap().keySet().stream()
   .filter(p -> p.equalsIgnoreCase(firstToken))
   .findFirst();
 if (positionPropertyName.isPresent()) {
  Object propertyValue = metaBean.metaProperty(positionPropertyName.get()).get((Bean) position);
  return propertyValue != null ?
    EvaluationResult.success(propertyValue, remainingTokens) :
    EvaluationResult.failure("Property '{}' not set", firstToken);
 }
 // position info
 Optional<String> positionInfoPropertyName = position.getInfo().propertyNames().stream()
   .filter(p -> p.equalsIgnoreCase(firstToken))
   .findFirst();
 if (positionInfoPropertyName.isPresent()) {
  Object propertyValue = position.getInfo().property(positionInfoPropertyName.get()).get();
  return propertyValue != null ?
    EvaluationResult.success(propertyValue, remainingTokens) :
    EvaluationResult.failure("Property '{}' not set", firstToken);
 }
 // not found
 return invalidTokenFailure(position, firstToken);
}
origin: OpenGamma/Strata

public void coverage() {
 coverImmutableBean(IntArray.of(1, 2, 3));
 IntArray.of(1, 2, 3).metaBean().metaProperty("array").metaBean();
 IntArray.of(1, 2, 3).metaBean().metaProperty("array").propertyGenericType();
 IntArray.of(1, 2, 3).metaBean().metaProperty("array").annotations();
}
origin: OpenGamma/Strata

Object propertyValue = metaBean.metaProperty(tradePropertyName.get()).get((Bean) trade);
if (propertyValue == null) {
 return EvaluationResult.failure("Property '{}' not set", firstToken);
origin: OpenGamma/Strata

public void coverage() {
 coverImmutableBean(DoubleArray.of(1d, 2d, 3d));
 DoubleArray.of(1d, 2d, 3d).metaBean().metaProperty("array").metaBean();
 DoubleArray.of(1d, 2d, 3d).metaBean().metaProperty("array").propertyGenericType();
 DoubleArray.of(1d, 2d, 3d).metaBean().metaProperty("array").annotations();
}
origin: OpenGamma/Strata

@Override
public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {
 try {
  return metaBean.metaProperty(propertyName);
 } catch (NoSuchElementException ex) {
  if (BASE_CURRENCY_AMOUNT.name().equals(propertyName)) {
   return BASE_CURRENCY_AMOUNT;
  }
  if (COUNTER_CURRENCY_AMOUNT.name().equals(propertyName)) {
   return COUNTER_CURRENCY_AMOUNT;
  }
  if (PAYMENT_DATE.name().equals(propertyName)) {
   return PAYMENT_DATE;
  }
  throw ex;
 }
}
origin: OpenGamma/Strata

  .findFirst();
if (securityPropertyName.isPresent()) {
 Object propertyValue = metaBean.metaProperty(securityPropertyName.get()).get((Bean) security);
 return propertyValue != null ?
   EvaluationResult.success(propertyValue, remainingTokens) :
origin: OpenGamma/Strata

@Override
public <R> Property<R> property(String propertyName) {
 return metaBean().<R>metaProperty(propertyName).createProperty(this);
}
origin: OpenGamma/Strata

@Override
public Object get(String propertyName) {
 if (propertyName.equals(ARRAY.name())) {
  return array.clone();
 } else {
  throw new NoSuchElementException("Unknown property: " + propertyName);
 }
}
origin: OpenGamma/Strata

private <T> CurrencyParameterSensitivities sensitivity(
  ImmutableLegalEntityDiscountingProvider provider,
  Function<ImmutableLegalEntityDiscountingProvider, CurrencyAmount> valueFn,
  MetaProperty<ImmutableMap<Pair<T, Currency>, DiscountFactors>> metaProperty,
  CurrencyAmount valueInit) {
 ImmutableMap<Pair<T, Currency>, DiscountFactors> baseCurves = metaProperty.get(provider);
 CurrencyParameterSensitivities result = CurrencyParameterSensitivities.empty();
 for (Pair<T, Currency> key : baseCurves.keySet()) {
  DiscountFactors discountFactors = baseCurves.get(key);
  Curve curve = checkDiscountFactors(discountFactors);
  int paramCount = curve.getParameterCount();
  double[] sensitivity = new double[paramCount];
  for (int i = 0; i < paramCount; i++) {
   Curve dscBumped = curve.withParameter(i, curve.getParameter(i) + shift);
   Map<Pair<T, Currency>, DiscountFactors> mapBumped = new HashMap<>(baseCurves);
   mapBumped.put(key, createDiscountFactors(discountFactors, dscBumped));
   ImmutableLegalEntityDiscountingProvider providerDscBumped = provider.toBuilder().set(metaProperty, mapBumped).build();
   sensitivity[i] = (valueFn.apply(providerDscBumped).getAmount() - valueInit.getAmount()) / shift;
  }
  result = result.combinedWith(
    curve.createParameterSensitivity(valueInit.getCurrency(), DoubleArray.copyOf(sensitivity)));
 }
 return result;
}
origin: OpenGamma/Strata

@Override
public Object get(String propertyName) {
 if (propertyName.equals(ARRAY.name())) {
  return array.clone();
 } else {
  throw new NoSuchElementException("Unknown property: " + propertyName);
 }
}
origin: OpenGamma/Strata

private <T> CurrencyParameterSensitivities sensitivityDiscountCurve(
  ImmutableCreditRatesProvider provider,
  Function<ImmutableCreditRatesProvider, CurrencyAmount> valueFn,
  MetaProperty<ImmutableMap<T, CreditDiscountFactors>> metaProperty,
  CurrencyAmount valueInit) {
 ImmutableMap<T, CreditDiscountFactors> baseCurves = metaProperty.get(provider);
 CurrencyParameterSensitivities result = CurrencyParameterSensitivities.empty();
 for (T key : baseCurves.keySet()) {
  CreditDiscountFactors creditDiscountFactors = baseCurves.get(key);
  DiscountFactors discountFactors = creditDiscountFactors.toDiscountFactors();
  Curve curve = checkDiscountFactors(discountFactors);
  int paramCount = curve.getParameterCount();
  double[] sensitivity = new double[paramCount];
  for (int i = 0; i < paramCount; i++) {
   Curve dscBumped = curve.withParameter(i, curve.getParameter(i) + shift);
   Map<T, CreditDiscountFactors> mapBumped = new HashMap<>(baseCurves);
   mapBumped.put(key, createCreditDiscountFactors(creditDiscountFactors, dscBumped));
   ImmutableCreditRatesProvider providerDscBumped = provider.toBuilder().set(metaProperty, mapBumped).build();
   sensitivity[i] = (valueFn.apply(providerDscBumped).getAmount() - valueInit.getAmount()) / shift;
  }
  result = result.combinedWith(
    curve.createParameterSensitivity(valueInit.getCurrency(), DoubleArray.copyOf(sensitivity)));
 }
 return result;
}
origin: OpenGamma/Strata

@Override
public BeanBuilder<IntArray> set(String propertyName, Object value) {
 if (propertyName.equals(ARRAY.name())) {
  this.array = ((int[]) ArgChecker.notNull(value, "value")).clone();
 } else {
  throw new NoSuchElementException("Unknown property: " + propertyName);
 }
 return this;
}
origin: OpenGamma/Strata

private CurrencyAmount fn(ImmutableLegalEntityDiscountingProvider provider) {
 double result = 0.0;
 // issuer curve
 ImmutableMap<Pair<LegalEntityGroup, Currency>, DiscountFactors> mapLegal = provider.metaBean().issuerCurves()
   .get(provider);
 for (Entry<Pair<LegalEntityGroup, Currency>, DiscountFactors> entry : mapLegal.entrySet()) {
  InterpolatedNodalCurve curveInt = checkInterpolated(checkDiscountFactors(entry.getValue()));
  result += sumProduct(curveInt);
 }
 // repo curve
 ImmutableMap<Pair<RepoGroup, Currency>, DiscountFactors> mapRepo = provider.metaBean().repoCurves().get(provider);
 for (Entry<Pair<RepoGroup, Currency>, DiscountFactors> entry : mapRepo.entrySet()) {
  InterpolatedNodalCurve curveInt = checkInterpolated(checkDiscountFactors(entry.getValue()));
  result += sumProduct(curveInt);
 }
 return CurrencyAmount.of(USD, result);
}
origin: OpenGamma/Strata

@Override
public BeanBuilder<DoubleArray> set(String propertyName, Object value) {
 if (propertyName.equals(ARRAY.name())) {
  this.array = ((double[]) ArgChecker.notNull(value, "value")).clone();
 } else {
  throw new NoSuchElementException("Unknown property: " + propertyName);
 }
 return this;
}
origin: OpenGamma/Strata

private <T> CurrencyParameterSensitivities sensitivityCreidtCurve(
  ImmutableCreditRatesProvider provider,
  Function<ImmutableCreditRatesProvider, CurrencyAmount> valueFn,
  MetaProperty<ImmutableMap<T, LegalEntitySurvivalProbabilities>> metaProperty,
  CurrencyAmount valueInit) {
 ImmutableMap<T, LegalEntitySurvivalProbabilities> baseCurves = metaProperty.get(provider);
 CurrencyParameterSensitivities result = CurrencyParameterSensitivities.empty();
 for (T key : baseCurves.keySet()) {
  LegalEntitySurvivalProbabilities credit = baseCurves.get(key);
  CreditDiscountFactors creditDiscountFactors = credit.getSurvivalProbabilities();
  DiscountFactors discountFactors = creditDiscountFactors.toDiscountFactors();
  Curve curve = checkDiscountFactors(discountFactors);
  int paramCount = curve.getParameterCount();
  double[] sensitivity = new double[paramCount];
  for (int i = 0; i < paramCount; i++) {
   Curve dscBumped = curve.withParameter(i, curve.getParameter(i) + shift);
   Map<T, LegalEntitySurvivalProbabilities> mapBumped = new HashMap<>(baseCurves);
   mapBumped.put(key, LegalEntitySurvivalProbabilities.of(
     credit.getLegalEntityId(), createCreditDiscountFactors(creditDiscountFactors, dscBumped)));
   ImmutableCreditRatesProvider providerDscBumped = provider.toBuilder().set(metaProperty, mapBumped).build();
   sensitivity[i] = (valueFn.apply(providerDscBumped).getAmount() - valueInit.getAmount()) / shift;
  }
  result = result.combinedWith(
    curve.createParameterSensitivity(valueInit.getCurrency(), DoubleArray.copyOf(sensitivity)));
 }
 return result;
}
origin: OpenGamma/Strata

public void test_builder() {
 assertThrowsIllegalArg(() -> DiscountFxForwardRates.meta().builder()
   .set(DiscountFxForwardRates.meta().currencyPair(), CurrencyPair.parse("GBP/USD")).build());
 assertThrowsIllegalArg(() -> DiscountFxForwardRates.meta().builder()
   .set(DiscountFxForwardRates.meta().currencyPair().name(), CurrencyPair.parse("GBP/USD")).build());
}
origin: OpenGamma/Strata

public void test_builder() {
 LocalDateDoubleTimeSeries ts = LocalDateDoubleTimeSeries.of(PREV_DATE, 0.62d);
 ImmutableRatesProvider test = ImmutableRatesProvider.builder(VAL_DATE)
   .timeSeries(GBP_USD_WM, ts)
   .build();
 assertEquals(test.getValuationDate(), VAL_DATE);
 assertEquals(ImmutableRatesProvider.meta().timeSeries().get(test), ImmutableMap.of(GBP_USD_WM, ts));
 assertSame(test.toImmutableRatesProvider(), test);
}
org.joda.beansMetaProperty

Most used methods

  • name
  • get
  • annotations
  • createProperty
  • metaBean
  • propertyGenericType
  • propertyType

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now