JavaResult
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.milyn.payload.JavaResult(Showing top 15 results out of 315)

origin: org.switchyard/switchyard-transform

  private Object extractResultData(Result result) {
    if (result instanceof StringResult) {
      return ((StringResult) result).getResult();
    } else if (result instanceof JavaResult) {
      return ((JavaResult) result).extractFromResult((JavaResult) result, _export);
    }
    return null;
  }
}
origin: smooks/smooks

public List bind(Reader fixedLengthStream) {
  AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream");
  JavaResult javaResult = new JavaResult();
  smooks.filterSource(new StreamSource(fixedLengthStream), javaResult);
  return (List) javaResult.getBean(beanId);
}
origin: smooks/smooks

private Object extractBeans(JavaResult result, Collection<String> extractSet) {
  Map<String, Object> extractedObjects = new ResultMap<String, Object>();
  for(String extract : extractSet) {
    Object bean = result.getBean(extract);
    if(bean != null) {
      extractedObjects.put(extract, bean);
    }
  }
  return extractedObjects;
}
origin: smooks/smooks

@Converter
public static JavaSource toJavaSource(JavaResult result)
{
  return new JavaSource(result.getResultMap().values());
}

origin: org.milyn/milyn-smooks-core

public Object extractFromResult(JavaResult result, Export export)
{
  Set<String> extractSet = export.getExtractSet();
  if (extractSet == null) {
    return extractBeans(result, result.getResultMap().keySet());
  }
  if(extractSet.size() == 1) {
    return result.getBean(extractSet.iterator().next());
  } else {
    return extractBeans(result, extractSet);
  }
}
origin: org.milyn/milyn-smooks-javabean

public <T> T readObject(Reader message, Class<T> returnType) throws SAXException, IOException {
  Model<JavaResult> model = readModel(message, JavaResult.class);
  return model.getModelRoot().getBean(returnType);
}
origin: org.milyn/milyn-smooks-core

  public Result createResult( final ResultType type )
  {
    Result result = null;
    switch ( type )
    {
    case STRING:
      result = new StringResult();
      break;
    case BYTES:
      result = new ByteResult();
      break;
    case JAVA:
      result = new JavaResult(true);
      break;
    case NORESULT:
      break;

    default:
      result = null;
      break;
    }
    
    return result;
  }
}
origin: smooks/smooks

/**
 * Write the bean model to the specified {@link Writer} instance.
 * @param writer The writer instance.
 * @throws BeanRegistrationException One of the "namespace root" beans in the model is not {@link #registerBean(Object) registered}.
 * @throws IOException Error while writing the model to the supplied {@link Writer} instance.
 */
public synchronized void writeModel(Writer writer) throws BeanRegistrationException, IOException {
  AssertArgument.isNotNull(writer, "writer");
  Object rootBean;
  if(modelRoot instanceof JavaResult) {
    JavaResult javaResult = (JavaResult) modelRoot;
    Map<String, Object> beanMap = javaResult.getResultMap();
    if(beanMap.isEmpty()) {
      throw new IOException("Unable to serialize empty JavaResult Model.");
    } else if(beanMap.size() > 1) {
      throw new IOException("Unable to serialize JavaResult Model that contains more than 1 bean instance.");
    }
    rootBean = beanMap.values().iterator().next();
  } else {
    rootBean = modelRoot;
  }
  resolveModelNamespaces();
  resolveUnmappedBeanWriters();
  BeanWriter beanWriter = getBeanWriter(rootBean);
  beanWriter.write(rootBean, writer, this);
}
origin: smooks/smooks

/**
 * Bind the input source to the specified type.
 * <p/>
 * In order to make a cleaner API, implementing classes should create a more
 * appropriately named method based on the target binding format, that just
 * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)}
 * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}.
 *
 * @param inputSource The input source.
 * @param toType      The target type.
 * @return The target binding type instance.
 * @throws IOException Error binding source to target type.
 */
protected <T> T bind(Source inputSource, Class<T> toType) throws IOException {
  AssertArgument.isNotNull(inputSource, "inputSource");
  AssertArgument.isNotNull(toType, "toType");
  assertInitialized();
  JavaResult javaResult = new JavaResult();
  ExecutionContext executionContext = smooks.createExecutionContext();
  if (reportPath != null) {
    executionContext.setEventListener(new HtmlReportGenerator(reportPath));
  }
  smooks.filterSource(executionContext, inputSource, javaResult);
  return javaResult.getBean(toType);
}
origin: smooks/smooks

public Map bind(Reader fixedLengthStream) {
  AssertArgument.isNotNull(fixedLengthStream, "fixedLengthStream");
  JavaResult javaResult = new JavaResult();
  smooks.filterSource(new StreamSource(fixedLengthStream), javaResult);
  return (Map) javaResult.getBean(beanId);
}
origin: smooks/smooks

public List bind(Reader csvStream) {
  AssertArgument.isNotNull(csvStream, "csvStream");
  JavaResult javaResult = new JavaResult();
  smooks.filterSource(new StreamSource(csvStream), javaResult);
  return (List) javaResult.getBean(beanId);
}
origin: org.milyn/milyn-smooks-core

private Object extractBeans(JavaResult result, Collection<String> extractSet) {
  Map<String, Object> extractedObjects = new ResultMap<String, Object>();
  for(String extract : extractSet) {
    Object bean = result.getBean(extract);
    if(bean != null) {
      extractedObjects.put(extract, bean);
    }
  }
  return extractedObjects;
}
origin: smooks/smooks

public Object extractFromResult(JavaResult result, Export export)
{
  Set<String> extractSet = export.getExtractSet();
  if (extractSet == null) {
    return extractBeans(result, result.getResultMap().keySet());
  }
  if(extractSet.size() == 1) {
    return result.getBean(extractSet.iterator().next());
  } else {
    return extractBeans(result, extractSet);
  }
}
origin: smooks/smooks

public Map bind(Reader csvStream) {
  AssertArgument.isNotNull(csvStream, "csvStream");
  JavaResult javaResult = new JavaResult();
  smooks.filterSource(new StreamSource(csvStream), javaResult);
  return (Map) javaResult.getBean(beanId);
}
origin: smooks/smooks

public <T> T readObject(Reader message, Class<T> returnType) throws SAXException, IOException {
  Model<JavaResult> model = readModel(message, JavaResult.class);
  return model.getModelRoot().getBean(returnType);
}
org.milyn.payloadJavaResult

Javadoc

Java filtration/transformation result.

Used to extract a Java " Result" Map from the transformation. Simply set an instance of this class as the Result arg in the call to org.milyn.Smooks#filterSource(org.milyn.container.ExecutionContext,javax.xml.transform.Source,javax.xml.transform.Result...) .

Most used methods

  • <init>
    Public default constructor.
  • getBean
    Get the named bean from the Java Result Map.
  • getResultMap
    Get the Java result map.
  • extractBeans
  • extractFromResult

Popular classes and methods

  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • notifyDataSetChanged (ArrayAdapter)
  • LinkedHashMap (java.util)
    Hash table implementation of the Map interface with predictable iteration order. [Sun docs] [http:/
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ImageIO (javax.imageio)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JComboBox (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)