예제 #1
0
 public static TypeDefinition<?> findTypedef(
     final Set<TypeDefinition<?>> typedefs, final String name) {
   TypeDefinition<?> result = null;
   for (TypeDefinition<?> td : typedefs) {
     if (td.getQName().getLocalName().equals(name)) {
       result = td;
       break;
     }
   }
   return result;
 }
예제 #2
0
  @SuppressWarnings("unchecked")
  private JSONCodec<Object> createFromSimpleType(final TypeDefinition<?> type) {
    if (type instanceof InstanceIdentifierTypeDefinition) {
      return (JSONCodec<Object>) iidCodec;
    }
    if (type instanceof EmptyTypeDefinition) {
      return JSONEmptyCodec.INSTANCE;
    }

    final TypeDefinitionAwareCodec<Object, ?> codec = TypeDefinitionAwareCodec.from(type);
    if (codec == null) {
      LOG.debug("Codec for type \"{}\" is not implemented yet.", type.getQName().getLocalName());
      return NULL_CODEC;
    }
    return (JSONCodec<Object>) AbstractJSONCodec.create(codec);
  }