Tabnine Logo
InboundVariable
Code IndexAdd Tabnine to your IDE (free)

How to use
InboundVariable
in
org.directwebremoting.extend

Best Java code snippets using org.directwebremoting.extend.InboundVariable (Showing top 20 results out of 315)

origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data)
{
  if (data.isNull())
  {
    return null;
  }
  try
  {
    Constructor<?> converter = paramType.getConstructor(String.class);
    return converter.newInstance(data.getValue());
  }
  catch (Exception ex)
  {
    throw new IllegalArgumentException(ex.toString());
  }
}
origin: org.directwebremoting/dwr

/**
 * Create an inbound file variable.
 * Usually called by a query parser to setup a list of known variables.
 * This method also checks to see if the new variable is a parameter and if
 * it is it updates the count of parameters
 * @param callNum The call number to work on
 * @param key The name of the variable
 * @param type The javascript type of the variable
 * @param value The value of the file
 */
public void createInboundVariable(int callNum, String key, String type, FormField value)
{
  InboundVariable iv = new InboundVariable(this, key, type, value);
  checkInboundVariable(callNum, key, iv);
}
origin: org.directwebremoting/dwr

/**
 * When we are sure we have finished parsing the input, we can begin to
 * fix all cross-references.
 * @throws ConversionException If cross-references don't add up
 */
public void dereference() throws ConversionException
{
  for (InboundVariable variable : variables.values())
  {
    variable.dereference();
  }
}
origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
{
  if (data.isNull())
  {
    return null;
  }
  return data.urlDecode().toCharArray();
}
origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
{
  if (data.isNull())
  {
    return null;
  }
  if (data.getFormField().isFile())
  {
    // Data from file uploads is not URL encoded
    return data.getValue();
  }
  else
  {
    return data.urlDecode();
  }
}
origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
  if (data.isNull())
  InboundContext incx = data.getContext();
  InboundVariable[] members = data.getMembers();
  if (members != null)
    data.getContext().addConverted(data, paramType, array);
      Object output = converterManager.convertInbound(componentType, members[i], data.getContext().getCurrentProperty());
      Array.set(array, i, output);
  String value = data.getValue();
  if (value.startsWith(ProtocolConstants.INBOUND_ARRAY_START))
    log.error("Found array end without array start: " + data.getValue());
    throw new IllegalArgumentException("Could not parse input. See logs for details.");
    log.error("Found array end without array end: " + data.getValue());
    throw new IllegalArgumentException("Could not parse input. See logs for details.");
  data.getContext().addConverted(data, paramType, array);
    InboundVariable nested = new InboundVariable(incx, null, splitType, splitValue);
    nested.dereference();
    Object output = converterManager.convertInbound(componentType, nested, data.getContext().getCurrentProperty());
    Array.set(array, i, output);
origin: net.disy.legato/legato-tools

protected <T> T getValue(
  String name,
  Class<T> type,
  InboundVariable data,
  Map<String, String> tokens,
  InboundContext inctx) throws MarshallException {
 final T value;
 final String valueString = tokens.get(name);
 if (valueString != null) {
  final String[] split = ParseUtil.splitInbound(valueString);
  final String splitValue = split[LocalUtil.INBOUND_INDEX_VALUE];
  final String splitType = split[LocalUtil.INBOUND_INDEX_TYPE];
  final InboundVariable nested = new InboundVariable(
    data.getLookup(),
    null,
    splitType,
    splitValue);
  @SuppressWarnings("unchecked")
  final T valueDraft = (T) getConverterManager().convertInbound(type, nested, inctx, null);
  value = valueDraft;
 }
 else {
  value = null;
 }
 return value;
}
origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
  if (data.isNull())
  String value = data.getValue();
  if (value == null)
    throw new NullPointerException(data.toString());
    log.warn("Expected object while converting data for " + paramType.getName() + " in " + data.getContext().getCurrentProperty() + ". Passed: " + value);
    throw new ConversionException(paramType, "Data conversion error. See logs for more details.");
origin: org.directwebremoting/dwr

public String urlDecode() {
  if (!urlDecoded) {
    return LocalUtil.urlDecode(getValue());
  }
  return getValue();
}
origin: org.directwebremoting/dwr

String value = data.getValue();
  log.warn("Expected object while converting data for " + paramType.getName() + " in " + data.getContext().getCurrentProperty() + ". Passed: " + value);
  throw new ConversionException(paramType, "Data conversion error. See logs for more details.");
    data.getContext().addConverted(data, instanceType, bean);
    data.getContext().addConverted(data, paramType, bean);
    Object output = convert(val, propType, data.getContext(), property);
    property.setValue(bean, output);
origin: org.directwebremoting/dwr

/**
 * We have inbound data and a type that we need to convert it into, this
 * method performs the conversion.
 */
protected Object convert(String val, Class<?> propType, InboundContext inboundContext, Property property)
{
  String[] split = ConvertUtil.splitInbound(val);
  String splitValue = split[ConvertUtil.INBOUND_INDEX_VALUE];
  String splitType = split[ConvertUtil.INBOUND_INDEX_TYPE];
  InboundVariable nested = new InboundVariable(inboundContext, null, splitType, splitValue);
  nested.dereference();
  Property incc = createTypeHintContext(inboundContext, property);
  return converterManager.convertInbound(propType, nested, incc);
}
origin: infiniteautomation/ma-core-public

public Object convertInbound(@SuppressWarnings("rawtypes") Class paramType, InboundVariable iv,
    InboundContext inctx, TypeHintContext incc) throws MarshallException {
  Object converted = inctx.getConverted(iv, paramType);
  if (converted == null) {
    // Was the inbound variable marshalled as an Object in the client
    // (could mean that this is an instance of one of our generated
    // JavaScript classes)
    Converter converter = getNamedConverter(paramType, iv.getType());
    // Fall back to the standard way of locating a converter if we
    // didn't find anything above
    if (converter == null) {
      converter = getConverter(paramType);
    }
    if (converter == null) {
      throw new MarshallException(paramType, Messages.getString("DefaultConverterManager.MissingConverter",
          paramType));
    }
    // We only think about doing a null conversion ourselves once we are
    // sure that there is a converter available. This prevents hackers
    // from passing null to things they are not allowed to convert
    if (iv.isNull()) {
      return null;
    }
    inctx.pushContext(incc);
    converted = converter.convertInbound(paramType, iv, inctx);
    inctx.popContext();
  }
  return converted;
}
origin: org.directwebremoting/dwr

public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
  if (data.isNull())
    final FormField formField = data.getFormField();
    if (paramType == FileTransfer.class)
origin: org.directwebremoting/dwr

String javaScriptType = param.getType();
origin: org.directwebremoting/dwr

@Override
public boolean equals(Object obj)
{
  if (!(obj instanceof Conversion))
  {
    return false;
  }
  Conversion that = (Conversion) obj;
  return this.type.equals(that.type) && this.inboundVariable.equals(that.inboundVariable);
}
origin: org.directwebremoting/dwr

@SuppressWarnings("unchecked")
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
  if (data.isNull())
  String value = data.getValue();
    log.warn("Expected collection while converting data for " + paramType.getName() + " in " + data.getContext().getCurrentProperty() + ". Passed: " + value);
    throw new ConversionException(paramType, "Data conversion error. See logs for more details.");
    Property parent = data.getContext().getCurrentProperty();
    Property child = parent.createChild(0);
    child = converterManager.checkOverride(child);
    data.getContext().addConverted(data, paramType, col);
      String splitValue = split[ConvertUtil.INBOUND_INDEX_VALUE];
      InboundVariable nested = new InboundVariable(data.getContext(), null, splitType, splitValue);
      nested.dereference();
origin: net.disy.wps/wps-api

@Override
protected Object convertInbound(
  @SuppressWarnings({ "rawtypes" }) Class paramType,
  InboundVariable data,
  Map<String, String> tokens,
  InboundContext inctx,
  String value) throws MarshallException {
 final String coordinatesString = tokens.get("coordinates"); //$NON-NLS-1$
 final String[] split = ParseUtil.splitInbound(coordinatesString);
 final String splitValue = split[LocalUtil.INBOUND_INDEX_VALUE];
 final String splitType = split[LocalUtil.INBOUND_INDEX_TYPE];
 final InboundVariable nested = new InboundVariable(
   data.getLookup(),
   null,
   splitType,
   splitValue);
 @SuppressWarnings("unchecked")
 final C coordinates = (C) getConverterManager().convertInbound(
   getCoordinatesType(),
   nested,
   inctx,
   null);
 return createGeometry(coordinates);
}
origin: org.directwebremoting/dwr

/**
 * Parses a locale string that matches language_country_variant.
 */
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
{
  return data.isNull() ? null : LocalUtil.parseLocaleString(data.urlDecode());
}
origin: infiniteautomation/ma-core-public

@Override
public Object convertInbound(Class paramClass,
    InboundVariable paramInboundVariable,
    InboundContext paramInboundContext) throws MarshallException {
  
  //Convert from string to Unit
  try{
    //For the ONE unit
    if(paramInboundVariable.getValue().equals("ONE"))
      return Unit.ONE;
    else
      return UnitUtil.parseLocal(URLDecoder.decode(paramInboundVariable.getValue(), Common.UTF8));
  }catch(Exception e){
    throw new MarshallException(paramClass);
  }
}
origin: org.directwebremoting/dwr

@SuppressWarnings("unchecked")
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException
  if (data.isNull())
  String value = data.getValue();
    log.warn("Expected object while converting data for " + paramType.getName() + " in " + data.getContext().getCurrentProperty() + ". Passed: " + value);
    throw new ConversionException(paramType, "Data conversion error. See logs for more details.");
    Property parent = data.getContext().getCurrentProperty();
    data.getContext().addConverted(data, paramType, map);
    InboundContext incx = data.getContext();
      String splitIvValue = splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
      String splitIvType = splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
      InboundVariable valIv = new InboundVariable(incx, null, splitIvType, splitIvValue);
      valIv.dereference();
      Object val = converterManager.convertInbound(valType, valIv, valProp);
      InboundVariable keyIv = new InboundVariable(incx, null, ProtocolConstants.TYPE_STRING, keyStr);
      keyIv.dereference();
org.directwebremoting.extendInboundVariable

Javadoc

A simple struct to hold data about a single converted javascript variable. An inbound variable will have either a value or a fileValue but not both. If file is true fileValue will be populated, otherwise value will be populated.

Most used methods

  • getValue
  • <init>
    Constructor for when we need to temporarily create an InboundVariable for sorting out varargs
  • getLookup
  • getType
  • isNull
    Was this type null on the way in
  • dereference
    Attempt to de-reference an inbound variable. We try de-referencing as soon as possible (why? there i
  • equals
  • getContext
    Accessor of the context of the variable: the other related variables
  • getFormField
  • getMembers
    Nasty hack to get around varargs
  • getNamedObjectType
    If we are using object parameters that have specified types then the ConverterManager will need to g
  • hashCode
  • getNamedObjectType,
  • hashCode,
  • toString,
  • urlDecode

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Reference (javax.naming)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now