idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
26,800
public static String unCamelify ( CharSequence original ) { StringBuilder result = new StringBuilder ( original . length ( ) ) ; boolean wasLowercase = false ; for ( int i = 0 ; i < original . length ( ) ; i ++ ) { char ch = original . charAt ( i ) ; if ( Character . isUpperCase ( ch ) && wasLowercase ) { result . append ( '-' ) ; } wasLowercase = Character . isLowerCase ( ch ) ; result . append ( Character . toLowerCase ( ch ) ) ; } return result . toString ( ) ; }
Turn CamelCaseText into gnu - style - lowercase .
26,801
public static MethodParameter createMethodParameter ( Executable executable , int i ) { MethodParameter methodParameter ; if ( executable instanceof Method ) { methodParameter = new MethodParameter ( ( Method ) executable , i ) ; } else if ( executable instanceof Constructor ) { methodParameter = new MethodParameter ( ( Constructor ) executable , i ) ; } else { throw new IllegalArgumentException ( "Unsupported Executable: " + executable ) ; } methodParameter . initParameterNameDiscovery ( new DefaultParameterNameDiscoverer ( ) ) ; return methodParameter ; }
Return a properly initialized MethodParameter for the given executable and index .
26,802
private boolean hasCommonParameter ( Parameter parameter ) { Parameter commonParameter = swagger . getParameter ( parameter . getName ( ) ) ; return commonParameter != null && parameter . getIn ( ) . equals ( commonParameter . getIn ( ) ) ; }
Returns true when the swagger object already contains a common parameter with the same name and type as the passed parameter .
26,803
protected final List < Parameter > getParameters ( Type type , List < Annotation > annotations ) { return getParameters ( type , annotations , typesToSkip ) ; }
this is final to enforce that only the implementation method below can be overridden to avoid confusion
26,804
protected List < Parameter > getParameters ( Type type , List < Annotation > annotations , Set < Type > typesToSkip ) { if ( ! hasValidAnnotations ( annotations ) || isApiParamHidden ( annotations ) ) { return Collections . emptyList ( ) ; } Iterator < SwaggerExtension > chain = SwaggerExtensions . chain ( ) ; List < Parameter > parameters = new ArrayList < > ( ) ; Class < ? > cls = TypeUtils . getRawType ( type , type ) ; LOG . debug ( "Looking for path/query/header/form/cookie params in " + cls ) ; if ( chain . hasNext ( ) ) { SwaggerExtension extension = chain . next ( ) ; LOG . debug ( "trying extension " + extension ) ; parameters = extension . extractParameters ( annotations , type , typesToSkip , chain ) ; } if ( ! parameters . isEmpty ( ) ) { for ( Parameter parameter : parameters ) { ParameterProcessor . applyAnnotations ( swagger , parameter , type , annotations ) ; } } else { LOG . debug ( "Looking for body params in " + cls ) ; parameters = Lists . newArrayList ( ) ; if ( ! typesToSkip . contains ( type ) ) { Parameter param = ParameterProcessor . applyAnnotations ( swagger , null , type , annotations ) ; if ( param != null ) { parameters . add ( param ) ; } } } return parameters ; }
this method exists so that outside callers can choose their own custom types to skip
26,805
public static String [ ] getControllerResquestMapping ( Class < ? > controllerClazz ) { String [ ] controllerRequestMappingValues = { } ; RequestMapping classRequestMapping = AnnotationUtils . findAnnotation ( controllerClazz , RequestMapping . class ) ; if ( classRequestMapping != null ) { controllerRequestMappingValues = classRequestMapping . value ( ) ; } if ( controllerRequestMappingValues . length == 0 ) { controllerRequestMappingValues = new String [ 1 ] ; controllerRequestMappingValues [ 0 ] = "" ; } return controllerRequestMappingValues ; }
Extracts all routes from the annotated class
26,806
private void validateConfiguration ( ApiSource apiSource ) throws GenerateException { if ( apiSource == null ) { throw new GenerateException ( "You do not configure any apiSource!" ) ; } else if ( apiSource . getInfo ( ) == null ) { throw new GenerateException ( "`<info>` is required by Swagger Spec." ) ; } if ( apiSource . getInfo ( ) . getTitle ( ) == null ) { throw new GenerateException ( "`<info><title>` is required by Swagger Spec." ) ; } if ( apiSource . getInfo ( ) . getVersion ( ) == null ) { throw new GenerateException ( "`<info><version>` is required by Swagger Spec." ) ; } if ( apiSource . getInfo ( ) . getLicense ( ) != null && apiSource . getInfo ( ) . getLicense ( ) . getName ( ) == null ) { throw new GenerateException ( "`<info><license><name>` is required by Swagger Spec." ) ; } if ( apiSource . getLocations ( ) == null ) { throw new GenerateException ( "<locations> is required by this plugin." ) ; } }
validate configuration according to swagger spec and plugin requirement
26,807
private void loadSwaggerExtensions ( ApiSource apiSource ) throws GenerateException { if ( apiSource . getSwaggerExtensions ( ) != null ) { List < SwaggerExtension > extensions = SwaggerExtensions . getExtensions ( ) ; extensions . addAll ( resolveSwaggerExtensions ( ) ) ; } }
The reader may modify the extensions list therefore add the additional swagger extensions after the instantiation of the reader
26,808
public static Diagram diagram ( String name , Figure figure ) { return new Diagram ( requireNonNull ( name , "name" ) , FigureBuilder . root ( requireNonNull ( figure , "figure" ) ) ) ; }
Factory methods for constructing diagrams directly
26,809
public static MethodHandle defaultInvoker ( Method method ) { if ( ! method . isDefault ( ) ) { throw new IllegalArgumentException ( "Not a default method: " + method ) ; } try { return LOOKUP . unreflectSpecial ( method , method . getDeclaringClass ( ) ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "Reflection failed." , e ) ; } }
Returns a method handle that invoke a default method of an interface .
26,810
public static Object invoke ( MethodHandle method , Object target ) { try { return method . invokeWithArguments ( target ) ; } catch ( RuntimeException | Error e ) { throw e ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } }
Invoke the given method handle with the specified single argument . Handles the exceptions declared by MethodHandle allowing this method to be used in a context where no checked exceptions may be thrown .
26,811
public < T > T parse ( XmlParser < T > parser ) throws ParserConfigurationException , SAXException , IOException { return resolver . parse ( path , parser ) ; }
Parse this XML document with the given parser .
26,812
public < T > Optional < T > parseOnce ( XmlParser < ? extends T > parser ) throws IOException , SAXException , ParserConfigurationException { return resolver . parsed ( path ) ? Optional . empty ( ) : Optional . of ( parse ( parser ) ) ; }
Parse this XML document with the given parser if it has not already been parsed .
26,813
private static int findStart ( char [ ] buffer , int start , int end ) { int pos , cp ; for ( pos = start ; pos < end && isWhitespace ( cp = codePointAt ( buffer , pos ) ) ; pos += charCount ( cp ) ) { if ( cp == '\n' ) { start = pos + 1 ; } } return pos >= end ? end : start ; }
Find the beginning of the first line that isn t all whitespace .
26,814
private static void textLiteral ( Consumer < ? super LiteralNode > add , String literal ) { add . accept ( literal ( literal , false ) ) ; }
Creates a text literal a case insensitive literal .
26,815
public Object getVal ( long waitTime , TimeUnit timeUnit ) throws InterruptedException { if ( latch . await ( waitTime , timeUnit ) ) { return val ; } else { return null ; } }
This method blocks for a specified amount of time to retrieve the value bound in bind method .
26,816
public void closeAfterFlushingPendingWrites ( Channel channel , Event event ) { if ( channel . isConnected ( ) ) { channel . write ( event ) . addListener ( ChannelFutureListener . CLOSE ) ; } else { System . err . println ( "Unable to write the Event :" + event + " to socket as channel is ot connected" ) ; } }
This method will write an event to the channel and then add a close listener which will close it after the write has completed .
26,817
public ChannelBuffer convertBAOSToChannelBuffer ( ByteArrayOutputStream baos ) { if ( null == baos ) return null ; return wrappedBuffer ( baos . toByteArray ( ) ) ; }
Utility method to convert a byte array output stream object to a Netty channel buffer . This method will created a wrapped buffer which will not do any copy .
26,818
@ SuppressWarnings ( "unchecked" ) public < T > T fromAmf ( final ByteArrayInputStream amf ) throws ClassNotFoundException , IOException { Amf3Input amf3Input = new Amf3Input ( context ) ; amf3Input . setInputStream ( amf ) ; return ( T ) amf3Input . readObject ( ) ; }
This method takes an AMF3 object in byte array form and converts it to a corresponding java object .
26,819
public static String readString ( ChannelBuffer buffer , Charset charset ) { String readString = null ; if ( null != buffer && buffer . readableBytes ( ) > 2 ) { int length = buffer . readUnsignedShort ( ) ; readString = readString ( buffer , length , charset ) ; } return readString ; }
This method will first read an unsigned short to find the length of the string and then read the actual string based on the length . This method will also reset the reader index to end of the string
26,820
public static String readString ( ChannelBuffer buffer , int length , Charset charset ) { String str = null ; if ( null == charset ) { charset = CharsetUtil . UTF_8 ; } try { ChannelBuffer stringBuffer = buffer . readSlice ( length ) ; str = stringBuffer . toString ( charset ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return str ; }
Read a string from a channel buffer with the specified length . It resets the reader index of the buffer to the end of the string . Defaults to UTF - 8 encoding in case charset passed in is null
26,821
public static ChannelBuffer writeString ( String msg , Charset charset ) { ChannelBuffer buffer = null ; try { ChannelBuffer stringBuffer = null ; if ( null == charset ) { charset = CharsetUtil . UTF_8 ; } stringBuffer = copiedBuffer ( ByteOrder . BIG_ENDIAN , msg , charset ) ; int length = stringBuffer . readableBytes ( ) ; ChannelBuffer lengthBuffer = ChannelBuffers . buffer ( 2 ) ; lengthBuffer . writeShort ( length ) ; buffer = ChannelBuffers . wrappedBuffer ( lengthBuffer , stringBuffer ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return buffer ; }
Creates a channel buffer of which the first 2 bytes contain the length of the string in bytes and the remaining is the actual string in binary with specified format . Defaults to UTF - 8 encoding in case charset passed in is null
26,822
public void init ( ) { pipeline = pipeline ( ) ; pipeline . addLast ( "messageBufferEventDecoder" , messageBufferEventDecoder ) ; pipeline . addLast ( "upstream" , upstream ) ; pipeline . addLast ( "messageBufferEventEncoder" , messageBufferEventEncoder ) ; }
This method creates a single pipeline object that will be shared for all the channels .
26,823
public static Fiber pooledFiber ( Lane < String , ExecutorService > lane ) { if ( null == lanePoolFactoryMap . get ( lane ) ) { lanePoolFactoryMap . putIfAbsent ( lane , new PoolFiberFactory ( lane . getUnderlyingLane ( ) ) ) ; } Fiber fiber = lanePoolFactoryMap . get ( lane ) . create ( ) ; fiber . start ( ) ; return fiber ; }
Creates and starts a fiber and returns the created instance .
26,824
public < T > ByteArrayOutputStream toAmf ( final T source ) throws IOException { final ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; final Amf3Output amf3Output = new Amf3Output ( context ) ; amf3Output . setOutputStream ( bout ) ; amf3Output . writeObject ( source ) ; amf3Output . flush ( ) ; amf3Output . close ( ) ; return bout ; }
Method used to convert the java object to AMF3 format . This method in turn delegates this conversion to the blazeds class AMF3 output .
26,825
public static Object getBean ( String beanName ) { if ( null == beanName ) { return null ; } return applicationContext . getBean ( beanName ) ; }
This method is used to retrieve a bean by its name . Note that this may result in new bean creation if the scope is set to prototype in the bean configuration file .
26,826
public static void clearPipeline ( ChannelPipeline pipeline ) { if ( null == pipeline ) { return ; } try { int counter = 0 ; while ( pipeline . getFirst ( ) != null ) { pipeline . removeFirst ( ) ; counter ++ ; } LOG . trace ( "Removed {} handlers from pipeline" , counter ) ; } catch ( NoSuchElementException e ) { } }
A utility method to clear the netty pipeline of all handlers .
26,827
public static String readString ( ChannelBuffer buffer , int length ) { return readString ( buffer , length , CharsetUtil . UTF_8 ) ; }
Read a string from a channel buffer with the specified length . It resets the reader index of the buffer to the end of the string .
26,828
public static InetSocketAddress readSocketAddress ( ChannelBuffer buffer ) { String remoteHost = NettyUtils . readString ( buffer ) ; int remotePort = 0 ; if ( buffer . readableBytes ( ) >= 4 ) { remotePort = buffer . readInt ( ) ; } else { return null ; } InetSocketAddress remoteAddress = null ; if ( null != remoteHost ) { remoteAddress = new InetSocketAddress ( remoteHost , remotePort ) ; } return remoteAddress ; }
Read a socket address from a buffer . The socket address will be provided as two strings containing host and port .
26,829
protected void createAndAddEventHandlers ( PlayerSession playerSession ) { EventHandler networkEventHandler = new NetworkEventListener ( playerSession ) ; this . eventDispatcher . addHandler ( networkEventHandler ) ; LOG . trace ( "Added Network handler to " + "EventDispatcher of GameRoom {}, for session: {}" , this , playerSession ) ; }
Method which will create and add event handlers of the player session to the Game Room s EventDispatcher .
26,830
protected void addANYHandler ( final EventHandler eventHandler ) { final int eventType = eventHandler . getEventType ( ) ; if ( eventType != Events . ANY ) { LOG . error ( "The incoming handler {} is not of type ANY" , eventHandler ) ; throw new IllegalArgumentException ( "The incoming handler is not of type ANY" ) ; } anyHandler . add ( eventHandler ) ; Callback < List < Event > > eventCallback = createEventCallbackForHandler ( eventHandler ) ; BatchSubscriber < Event > batchEventSubscriber = new BatchSubscriber < Event > ( fiber , eventCallback , 0 , TimeUnit . MILLISECONDS ) ; Disposable disposable = eventQueue . subscribe ( batchEventSubscriber ) ; disposableHandlerMap . put ( eventHandler , disposable ) ; }
Creates a batch subscription to the jetlang memory channel for the ANY event handler . This method does not require synchronization since we are using CopyOnWriteArrayList
26,831
public MessageBuffer < ChannelBuffer > getLoginBuffer ( InetSocketAddress localUDPAddress ) throws Exception { ChannelBuffer loginBuffer ; ChannelBuffer credentials = NettyUtils . writeStrings ( username , password , connectionKey ) ; if ( null != localUDPAddress ) { ChannelBuffer udpAddressBuffer = NettyUtils . writeSocketAddress ( localUDPAddress ) ; loginBuffer = ChannelBuffers . wrappedBuffer ( credentials , udpAddressBuffer ) ; } else { loginBuffer = credentials ; } return new NettyMessageBuffer ( loginBuffer ) ; }
Creates the appropriate login buffer using username password connectionkey and the local address to which the UDP channel is bound .
26,832
public MessageBuffer < ChannelBuffer > getReconnectBuffer ( String reconnectKey , InetSocketAddress udpAddress ) { ChannelBuffer reconnectBuffer = null ; ChannelBuffer buffer = NettyUtils . writeString ( reconnectKey ) ; if ( null != udpAddress ) { reconnectBuffer = ChannelBuffers . wrappedBuffer ( buffer , NettyUtils . writeSocketAddress ( udpAddress ) ) ; } else { reconnectBuffer = buffer ; } return new NettyMessageBuffer ( reconnectBuffer ) ; }
Creates a wrapped netty buffer with reconnect key and udp address as its payload .
26,833
public void connectSession ( final Session session , EventHandler ... eventHandlers ) throws InterruptedException , Exception { InetSocketAddress udpAddress = null ; if ( null != udpClient ) { udpAddress = doUdpConnection ( session ) ; } if ( null != eventHandlers ) { for ( EventHandler eventHandler : eventHandlers ) { session . addHandler ( eventHandler ) ; if ( eventHandler instanceof SessionEventHandler ) { ( ( SessionEventHandler ) eventHandler ) . setSession ( session ) ; } } } MessageBuffer < ChannelBuffer > buffer = loginHelper . getLoginBuffer ( udpAddress ) ; Event loginEvent = Events . event ( buffer , Events . LOG_IN ) ; doTcpConnection ( session , loginEvent ) ; }
Connects the session to remote jetserver . Depending on the connection parameters provided to LoginHelper it can connect both TCP and UDP transports .
26,834
public void reconnectSession ( final Session session , String reconnectKey ) throws InterruptedException , Exception { session . getTcpMessageSender ( ) . close ( ) ; if ( null != session . getUdpMessageSender ( ) ) session . getUdpMessageSender ( ) . close ( ) ; InetSocketAddress udpAddress = null ; if ( null != udpClient ) { udpAddress = doUdpConnection ( session ) ; } Event reconnectEvent = Events . event ( loginHelper . getReconnectBuffer ( reconnectKey , udpAddress ) , Events . RECONNECT ) ; doTcpConnection ( session , reconnectEvent ) ; }
Method used to reconnect existing session which probably got disconnected due to some exception . It will first close existing tcp and udp connections and then try re - connecting using the reconnect key from server .
26,835
public static void parametersNotNull ( final String names , final Object ... objects ) { String msgPrefix = "At least one of the parameters" ; if ( objects != null ) { if ( objects . length == 1 ) { msgPrefix = "Parameter" ; } for ( final Object object : objects ) { if ( object == null ) { raiseError ( String . format ( "%s '%s' is null." , msgPrefix , names ) ) ; } } } }
Validates that all the parameters are not null
26,836
public static void parameterNotNull ( final String name , final Object reference ) { if ( reference == null ) { raiseError ( format ( "Parameter '%s' is not expected to be null." , name ) ) ; } }
Validates that the parameter is not null
26,837
public static void parameterNotEmpty ( final String name , final Iterable obj ) { if ( ! obj . iterator ( ) . hasNext ( ) ) { raiseError ( format ( "Parameter '%s' from type '%s' is expected to NOT be empty" , name , obj . getClass ( ) . getName ( ) ) ) ; } }
Validates that the Iterable is not empty
26,838
public static void parameterNotEmpty ( final String name , final String value ) { if ( value != null && value . length ( ) == 0 ) { raiseError ( format ( "Parameter '%s' is expected to NOT be empty." , name ) ) ; } }
Validates that the value is not empty
26,839
@ SuppressWarnings ( "unchecked" ) public void loopMap ( final Object x , final MapIterCallback < K , V > callback ) { if ( x == null ) { return ; } if ( x instanceof Collection ) { throw new IllegalArgumentException ( "call loop instead" ) ; } if ( x instanceof HashMap < ? , ? > ) { if ( ( ( HashMap ) x ) . isEmpty ( ) ) { return ; } final HashMap < ? , ? > hm = ( HashMap < ? , ? > ) x ; for ( final Entry < ? , ? > e : hm . entrySet ( ) ) { callback . eval ( ( K ) e . getKey ( ) , ( V ) e . getValue ( ) ) ; } return ; } if ( x instanceof Map ) { final Map < K , V > m = ( Map < K , V > ) x ; for ( final Entry < K , V > entry : m . entrySet ( ) ) { callback . eval ( entry . getKey ( ) , entry . getValue ( ) ) ; } return ; } if ( x instanceof BSONObject ) { final BSONObject m = ( BSONObject ) x ; for ( final String k : m . keySet ( ) ) { callback . eval ( ( K ) k , ( V ) m . get ( k ) ) ; } } }
Process a Map
26,840
public UpdateOptions copy ( ) { return new UpdateOptions ( ) . bypassDocumentValidation ( getBypassDocumentValidation ( ) ) . collation ( getCollation ( ) ) . multi ( isMulti ( ) ) . upsert ( isUpsert ( ) ) . writeConcern ( getWriteConcern ( ) ) ; }
Create a copy of the options instance .
26,841
private static boolean isValueAValidGeoQuery ( final Object value ) { if ( value instanceof DBObject ) { String key = ( ( DBObject ) value ) . keySet ( ) . iterator ( ) . next ( ) ; return key . equals ( "$box" ) || key . equals ( "$center" ) || key . equals ( "$centerSphere" ) || key . equals ( "$polygon" ) ; } return false ; }
this could be a lot more rigorous
26,842
public void validate ( final Mapper mapper , final MappedClass mappedClass ) { validate ( mapper , singletonList ( mappedClass ) ) ; }
Validates a MappedClass
26,843
public void validate ( final Mapper mapper , final List < MappedClass > classes ) { final Set < ConstraintViolation > ve = new TreeSet < ConstraintViolation > ( new Comparator < ConstraintViolation > ( ) { public int compare ( final ConstraintViolation o1 , final ConstraintViolation o2 ) { return o1 . getLevel ( ) . ordinal ( ) > o2 . getLevel ( ) . ordinal ( ) ? - 1 : 1 ; } } ) ; final List < ClassConstraint > rules = getConstraints ( ) ; for ( final MappedClass c : classes ) { for ( final ClassConstraint v : rules ) { v . check ( mapper , c , ve ) ; } } if ( ! ve . isEmpty ( ) ) { final ConstraintViolation worst = ve . iterator ( ) . next ( ) ; final Level maxLevel = worst . getLevel ( ) ; if ( maxLevel . ordinal ( ) >= Level . FATAL . ordinal ( ) ) { throw new ConstraintViolationException ( ve ) ; } final List < LogLine > l = new ArrayList < LogLine > ( ) ; for ( final ConstraintViolation v : ve ) { l . add ( new LogLine ( v ) ) ; } sort ( l ) ; for ( final LogLine line : l ) { line . log ( LOG ) ; } } }
Validates a List of MappedClasses
26,844
@ SuppressWarnings ( "deprecation" ) public Datastore createDatastore ( final MongoClient mongoClient , final String dbName ) { return new DatastoreImpl ( this , mongoClient , dbName ) ; }
It is best to use a Mongo singleton instance here .
26,845
public synchronized Morphia mapPackage ( final String packageName , final boolean ignoreInvalidClasses ) { try { for ( final Class clazz : ReflectionUtils . getClasses ( getClass ( ) . getClassLoader ( ) , packageName , mapper . getOptions ( ) . isMapSubPackages ( ) ) ) { try { final Embedded embeddedAnn = ReflectionUtils . getClassEmbeddedAnnotation ( clazz ) ; final Entity entityAnn = ReflectionUtils . getClassEntityAnnotation ( clazz ) ; final boolean isAbstract = Modifier . isAbstract ( clazz . getModifiers ( ) ) ; if ( ( entityAnn != null || embeddedAnn != null ) && ! isAbstract ) { map ( clazz ) ; } } catch ( final MappingException ex ) { if ( ! ignoreInvalidClasses ) { throw ex ; } } } return this ; } catch ( IOException e ) { throw new MappingException ( "Could not get map classes from package " + packageName , e ) ; } catch ( ClassNotFoundException e ) { throw new MappingException ( "Could not get map classes from package " + packageName , e ) ; } }
Tries to map all classes in the package specified .
26,846
public DBObject toDBObject ( final Object entity ) { try { return mapper . toDBObject ( entity ) ; } catch ( Exception e ) { throw new MappingException ( "Could not map entity to DBObject" , e ) ; } }
Converts an entity to a DBObject . This method is primarily an internal method . Reliance on this method may break your application in future releases .
26,847
public MapReduceOptions < T > map ( final String map ) { Assert . parametersNotNull ( "map" , map ) ; Assert . parameterNotEmpty ( "map" , map ) ; this . map = map ; return this ; }
Set the JavaScript function that associates or maps a value with a key and emits the key and value pair .
26,848
public MapReduceOptions < T > query ( final Query query ) { Assert . parametersNotNull ( "query" , query ) ; this . query = query ; return this ; }
Sets the query defining the input for the job . Must not be null .
26,849
public MapReduceOptions < T > reduce ( final String reduce ) { Assert . parametersNotNull ( "reduce" , reduce ) ; Assert . parameterNotEmpty ( "reduce" , reduce ) ; this . reduce = reduce ; return this ; }
Sets the JavaScript function that reduces to a single object all the values associated with a particular key .
26,850
public static boolean isIntegerType ( final Class type ) { return Arrays . < Class > asList ( Integer . class , int . class , Long . class , long . class , Short . class , short . class , Byte . class , byte . class ) . contains ( type ) ; }
Checks if the class is an integer type i . e . is numeric but not a floating point type .
26,851
public static boolean isPropertyType ( final Type type ) { if ( type instanceof GenericArrayType ) { return isPropertyType ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ) ; } if ( type instanceof ParameterizedType ) { return isPropertyType ( ( ( ParameterizedType ) type ) . getRawType ( ) ) ; } return type instanceof Class && isPropertyType ( ( Class ) type ) ; }
Check if the class supplied represents a valid property type .
26,852
public static Type getParameterizedType ( final Field field , final int index ) { if ( field != null ) { if ( field . getGenericType ( ) instanceof ParameterizedType ) { final ParameterizedType type = ( ParameterizedType ) field . getGenericType ( ) ; if ( ( type . getActualTypeArguments ( ) != null ) && ( type . getActualTypeArguments ( ) . length <= index ) ) { return null ; } final Type paramType = type . getActualTypeArguments ( ) [ index ] ; if ( paramType instanceof GenericArrayType ) { return paramType ; } else { if ( paramType instanceof ParameterizedType ) { return paramType ; } else { if ( paramType instanceof TypeVariable ) { return paramType ; } else if ( paramType instanceof WildcardType ) { return paramType ; } else if ( paramType instanceof Class ) { return paramType ; } else { throw new MappingException ( "Unknown type... pretty bad... call for help, wave your hands... yeah!" ) ; } } } } return getParameterizedClass ( field . getType ( ) ) ; } return null ; }
Returns the parameterized type for a field
26,853
public static Class getParameterizedClass ( final Class c , final int index ) { final TypeVariable [ ] typeVars = c . getTypeParameters ( ) ; if ( typeVars . length > 0 ) { final TypeVariable typeVariable = typeVars [ index ] ; final Type [ ] bounds = typeVariable . getBounds ( ) ; final Type type = bounds [ 0 ] ; if ( type instanceof Class ) { return ( Class ) type ; } else { return null ; } } else { Type superclass = c . getGenericSuperclass ( ) ; if ( superclass == null && c . isInterface ( ) ) { Type [ ] interfaces = c . getGenericInterfaces ( ) ; if ( interfaces . length > 0 ) { superclass = interfaces [ index ] ; } } if ( superclass instanceof ParameterizedType ) { final Type [ ] actualTypeArguments = ( ( ParameterizedType ) superclass ) . getActualTypeArguments ( ) ; return actualTypeArguments . length > index ? ( Class < ? > ) actualTypeArguments [ index ] : null ; } else if ( ! Object . class . equals ( superclass ) ) { return getParameterizedClass ( ( Class ) superclass ) ; } else { return null ; } } }
Returns the parameterized type in the given position
26,854
public static boolean isFieldParameterizedWithClass ( final Field field , final Class c ) { if ( field . getGenericType ( ) instanceof ParameterizedType ) { final ParameterizedType genericType = ( ParameterizedType ) field . getGenericType ( ) ; for ( final Type type : genericType . getActualTypeArguments ( ) ) { if ( type == c ) { return true ; } if ( c . isInterface ( ) && implementsInterface ( ( Class ) type , c ) ) { return true ; } } } return false ; }
Check if a field is parameterized with a specific class .
26,855
public static boolean isFieldParameterizedWithPropertyType ( final Field field ) { if ( field . getGenericType ( ) instanceof ParameterizedType ) { final ParameterizedType genericType = ( ParameterizedType ) field . getGenericType ( ) ; for ( final Type type : genericType . getActualTypeArguments ( ) ) { if ( isPropertyType ( ( Class ) type ) ) { return true ; } } } return false ; }
Check if the field supplied is parameterized with a valid JCR property type .
26,856
public static boolean isPropertyType ( final Class type ) { return type != null && ( isPrimitiveLike ( type ) || type == DBRef . class || type == Pattern . class || type == CodeWScope . class || type == ObjectId . class || type == Key . class || type == DBObject . class || type == BasicDBObject . class ) ; }
Checks if the Class given is a property type
26,857
public static boolean isPrimitiveLike ( final Class type ) { return type != null && ( type == String . class || type == char . class || type == Character . class || type == short . class || type == Short . class || type == Integer . class || type == int . class || type == Long . class || type == long . class || type == Double . class || type == double . class || type == float . class || type == Float . class || type == Boolean . class || type == boolean . class || type == Byte . class || type == byte . class || type == Date . class || type == Locale . class || type == Class . class || type == UUID . class || type == URI . class || type . isEnum ( ) ) ; }
Checks if the Class given is a primitive type . This includes the Java primitive types and their wrapper types .
26,858
public static < T > T getAnnotation ( final Class c , final Class < T > annotation ) { final List < T > found = getAnnotations ( c , annotation ) ; if ( found != null && ! found . isEmpty ( ) ) { return found . get ( 0 ) ; } else { return null ; } }
Returns an annotation on a Class if present
26,859
public static Set < Class < ? > > getFromJarFile ( final ClassLoader loader , final String jar , final String packageName , final boolean mapSubPackages ) throws IOException , ClassNotFoundException { final Set < Class < ? > > classes = new HashSet < Class < ? > > ( ) ; final JarInputStream jarFile = new JarInputStream ( new FileInputStream ( jar ) ) ; try { JarEntry jarEntry ; do { jarEntry = jarFile . getNextJarEntry ( ) ; if ( jarEntry != null ) { String className = jarEntry . getName ( ) ; if ( className . endsWith ( ".class" ) ) { String classPackageName = getPackageName ( className ) ; if ( classPackageName . equals ( packageName ) || ( mapSubPackages && isSubPackage ( classPackageName , packageName ) ) ) { className = stripFilenameExtension ( className ) ; classes . add ( Class . forName ( className . replace ( '/' , '.' ) , true , loader ) ) ; } } } } while ( jarEntry != null ) ; } finally { jarFile . close ( ) ; } return classes ; }
Returns the classes in a package found in a jar
26,860
public static Set < Class < ? > > getFromDirectory ( final ClassLoader loader , final File directory , final String packageName , final boolean mapSubPackages ) throws ClassNotFoundException { final Set < Class < ? > > classes = new HashSet < Class < ? > > ( ) ; if ( directory . exists ( ) ) { for ( final String file : getFileNames ( directory , packageName , mapSubPackages ) ) { if ( file . endsWith ( ".class" ) ) { final String name = stripFilenameExtension ( file ) ; final Class < ? > clazz = Class . forName ( name , true , loader ) ; classes . add ( clazz ) ; } } } return classes ; }
Returns the classes in a package found in a directory
26,861
public static < T > List < T > iterToList ( final Iterable < T > it ) { if ( it instanceof List ) { return ( List < T > ) it ; } if ( it == null ) { return null ; } final List < T > ar = new ArrayList < T > ( ) ; for ( final T o : it ) { ar . add ( o ) ; } return ar ; }
Converts an Iterable to a List
26,862
public static Object convertToArray ( final Class type , final List < ? > values ) { final Object exampleArray = Array . newInstance ( type , values . size ( ) ) ; try { return values . toArray ( ( Object [ ] ) exampleArray ) ; } catch ( ClassCastException e ) { for ( int i = 0 ; i < values . size ( ) ; i ++ ) { Array . set ( exampleArray , i , values . get ( i ) ) ; } return exampleArray ; } }
Converts a List to an array
26,863
public static < T > Class < ? > getTypeArgument ( final Class < ? extends T > clazz , final TypeVariable < ? extends GenericDeclaration > tv ) { final Map < Type , Type > resolvedTypes = new HashMap < Type , Type > ( ) ; Type type = clazz ; while ( type != null && ! Object . class . equals ( getClass ( type ) ) ) { if ( type instanceof Class ) { type = ( ( Class ) type ) . getGenericSuperclass ( ) ; } else { final ParameterizedType parameterizedType = ( ParameterizedType ) type ; final Class < ? > rawType = ( Class ) parameterizedType . getRawType ( ) ; final Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ; final TypeVariable < ? > [ ] typeParameters = rawType . getTypeParameters ( ) ; for ( int i = 0 ; i < actualTypeArguments . length ; i ++ ) { if ( typeParameters [ i ] . equals ( tv ) ) { final Class cls = getClass ( actualTypeArguments [ i ] ) ; if ( cls != null ) { return cls ; } Type typeToTest = resolvedTypes . get ( actualTypeArguments [ i ] ) ; while ( typeToTest != null ) { final Class classToTest = getClass ( typeToTest ) ; if ( classToTest != null ) { return classToTest ; } typeToTest = resolvedTypes . get ( typeToTest ) ; } } resolvedTypes . put ( typeParameters [ i ] , actualTypeArguments [ i ] ) ; } if ( ! rawType . equals ( Object . class ) ) { type = rawType . getGenericSuperclass ( ) ; } } } return null ; }
Returns the type argument
26,864
public Object setValue ( final Object value ) { final Object answer = this . value ; this . value = value ; return answer ; }
Note that this method only sets the local reference inside this object and does not modify the original Map .
26,865
@ SuppressWarnings ( "unchecked" ) public static < V > MorphiaReference < V > wrap ( final V value ) { if ( value instanceof List ) { return ( MorphiaReference < V > ) new ListReference < V > ( ( List < V > ) value ) ; } else if ( value instanceof Set ) { return ( MorphiaReference < V > ) new SetReference < V > ( ( Set < V > ) value ) ; } else if ( value instanceof Map ) { return ( MorphiaReference < V > ) new MapReference < V > ( ( Map < String , V > ) value ) ; } else { return new SingleReference < V > ( value ) ; } }
Wraps an value in a MorphiaReference to storing on an entity
26,866
public PushOptions sort ( final String field , final int direction ) { if ( sort != null ) { throw new IllegalStateException ( "sortDocument can not be set if sort already is" ) ; } if ( sortDocument == null ) { sortDocument = new BasicDBObject ( ) ; } sortDocument . put ( field , direction ) ; return this ; }
Sets the sort value for the update
26,867
private DBObject toDBObject ( final Projection projection ) { String target ; if ( firstStage ) { MappedField field = mapper . getMappedClass ( source ) . getMappedField ( projection . getTarget ( ) ) ; target = field != null ? field . getNameToStore ( ) : projection . getTarget ( ) ; } else { target = projection . getTarget ( ) ; } if ( projection . getProjections ( ) != null ) { List < Projection > list = projection . getProjections ( ) ; DBObject projections = new BasicDBObject ( ) ; for ( Projection subProjection : list ) { projections . putAll ( toDBObject ( subProjection ) ) ; } return new BasicDBObject ( target , projections ) ; } else if ( projection . getSource ( ) != null ) { return new BasicDBObject ( target , projection . getSource ( ) ) ; } else if ( projection . getArguments ( ) != null ) { DBObject args = toExpressionArgs ( projection . getArguments ( ) ) ; if ( target == null ) { if ( args instanceof List < ? > && ( ( List < ? > ) args ) . size ( ) == 1 ) { Object firstArg = ( ( List < ? > ) args ) . get ( 0 ) ; if ( firstArg instanceof DBObject ) { return ( DBObject ) firstArg ; } } return args ; } else { if ( args instanceof List < ? > && ( ( List < ? > ) args ) . size ( ) == 1 ) { return new BasicDBObject ( target , ( ( List < ? > ) args ) . get ( 0 ) ) ; } return new BasicDBObject ( target , args ) ; } } else { return new BasicDBObject ( target , projection . isSuppressed ( ) ? 0 : 1 ) ; } }
Converts a Projection to a DBObject for use by the Java driver .
26,868
public static String join ( final List < String > strings , final char delimiter ) { StringBuilder builder = new StringBuilder ( ) ; for ( String element : strings ) { if ( builder . length ( ) != 0 ) { builder . append ( delimiter ) ; } builder . append ( element ) ; } return builder . toString ( ) ; }
Joins strings with the given delimiter
26,869
public boolean apply ( final Class < ? > type , final Object value , final List < ValidationFailure > validationFailures ) { if ( appliesTo ( type ) ) { validate ( type , value , validationFailures ) ; return true ; } return false ; }
Apply validation for the given field . If the field is not of a type in the list returned by getTypeClasses the validation is not applied and this method returns false . If the type is in the list then the validate method is called to see if the value is of a type that can be applied to the given field type . Errors are appended to the validationFailures list .
26,870
public MappedClass addMappedClass ( final Class c ) { MappedClass mappedClass = mappedClasses . get ( c . getName ( ) ) ; if ( mappedClass == null ) { mappedClass = new MappedClass ( c , this ) ; return addMappedClass ( mappedClass , true ) ; } return mappedClass ; }
Creates a MappedClass and validates it .
26,871
public List < MappedClass > getSubTypes ( final MappedClass mc ) { List < MappedClass > subtypes = new ArrayList < MappedClass > ( ) ; for ( MappedClass mappedClass : getMappedClasses ( ) ) { if ( mappedClass . isSubType ( mc ) ) { subtypes . add ( mappedClass ) ; } } return subtypes ; }
Finds any subtypes for the given MappedClass .
26,872
public Class < ? > getClassFromCollection ( final String collection ) { final Set < MappedClass > mcs = mappedClassesByCollection . get ( collection ) ; if ( mcs == null || mcs . isEmpty ( ) ) { throw new MappingException ( format ( "The collection '%s' is not mapped to a java class." , collection ) ) ; } if ( mcs . size ( ) > 1 ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( format ( "Found more than one class mapped to collection '%s'%s" , collection , mcs ) ) ; } } return mcs . iterator ( ) . next ( ) . getClazz ( ) ; }
Looks up the class mapped to a named collection .
26,873
public String getCollectionName ( final Object object ) { if ( object == null ) { throw new IllegalArgumentException ( ) ; } final MappedClass mc = getMappedClass ( object ) ; return mc . getCollectionName ( ) ; }
Gets the mapped collection for an object instance or Class reference .
26,874
public Object getId ( final Object entity ) { Object unwrapped = entity ; if ( unwrapped == null ) { return null ; } unwrapped = ProxyHelper . unwrap ( unwrapped ) ; try { final MappedClass mappedClass = getMappedClass ( unwrapped . getClass ( ) ) ; if ( mappedClass != null ) { final Field idField = mappedClass . getIdField ( ) ; if ( idField != null ) { return idField . get ( unwrapped ) ; } } } catch ( Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; } return null ; }
Gets the ID value for an entity
26,875
public < T > Key < T > getKey ( final T entity ) { T unwrapped = entity ; if ( unwrapped instanceof ProxiedEntityReference ) { final ProxiedEntityReference proxy = ( ProxiedEntityReference ) unwrapped ; return ( Key < T > ) proxy . __getKey ( ) ; } unwrapped = ProxyHelper . unwrap ( unwrapped ) ; if ( unwrapped instanceof Key ) { return ( Key < T > ) unwrapped ; } final Object id = getId ( unwrapped ) ; final Class < T > aClass = ( Class < T > ) unwrapped . getClass ( ) ; return id == null ? null : new Key < T > ( aClass , getCollectionName ( aClass ) , id ) ; }
Gets the Key for an entity
26,876
public DBRef keyToDBRef ( final Key key ) { if ( key == null ) { return null ; } if ( key . getType ( ) == null && key . getCollection ( ) == null ) { throw new IllegalStateException ( "How can it be missing both?" ) ; } if ( key . getCollection ( ) == null ) { key . setCollection ( getCollectionName ( key . getType ( ) ) ) ; } Object id = key . getId ( ) ; if ( isMapped ( id . getClass ( ) ) ) { id = toMongoObject ( id , true ) ; } return new DBRef ( key . getCollection ( ) , id ) ; }
Converts a Key to a DBRef
26,877
public < T > Key < T > manualRefToKey ( final Class < T > type , final Object id ) { return id == null ? null : new Key < T > ( type , getCollectionName ( type ) , id ) ; }
Creates a Key for a type and an ID value
26,878
public < T > Key < T > refToKey ( final DBRef ref ) { return ref == null ? null : new Key < T > ( ( Class < ? extends T > ) getClassFromCollection ( ref . getCollectionName ( ) ) , ref . getCollectionName ( ) , ref . getId ( ) ) ; }
Converts a DBRef to a Key
26,879
public String updateCollection ( final Key key ) { if ( key . getCollection ( ) == null && key . getType ( ) == null ) { throw new IllegalStateException ( "Key is invalid! " + toString ( ) ) ; } else if ( key . getCollection ( ) == null ) { key . setCollection ( getMappedClass ( key . getType ( ) ) . getCollectionName ( ) ) ; } return key . getCollection ( ) ; }
Updates the collection value on a Key with the mapped value on the Key s type Class
26,880
private MappedClass addMappedClass ( final MappedClass mc , final boolean validate ) { addConverters ( mc ) ; if ( validate && ! mc . isInterface ( ) ) { mc . validate ( this ) ; } mappedClasses . put ( mc . getClazz ( ) . getName ( ) , mc ) ; Set < MappedClass > mcs = mappedClassesByCollection . get ( mc . getCollectionName ( ) ) ; if ( mcs == null ) { mcs = new CopyOnWriteArraySet < MappedClass > ( ) ; final Set < MappedClass > temp = mappedClassesByCollection . putIfAbsent ( mc . getCollectionName ( ) , mcs ) ; if ( temp != null ) { mcs = temp ; } } mcs . add ( mc ) ; return mc ; }
Add MappedClass to internal cache possibly validating first .
26,881
public EntityCacheStatistics copy ( ) { final EntityCacheStatistics copy = new EntityCacheStatistics ( ) ; copy . entities = entities ; copy . hits = hits ; copy . misses = misses ; return copy ; }
Copies the statistics
26,882
public DBObject toDBObject ( ) { DBObject dbObject = new BasicDBObject ( ) ; if ( granularity != null ) { dbObject . put ( "granularity" , granularity . getGranulality ( ) ) ; } DBObject output = new BasicDBObject ( ) ; for ( Map . Entry < String , Accumulator > entry : accumulators . entrySet ( ) ) { output . put ( entry . getKey ( ) , entry . getValue ( ) . toDBObject ( ) ) ; } if ( ! accumulators . isEmpty ( ) ) { dbObject . put ( "output" , output ) ; } return dbObject ; }
Converts a BucketAutoOptions to a DBObject for use by the Java driver .
26,883
public DBObject toDBObject ( ) { final BasicDBList list = new BasicDBList ( ) ; for ( final Point point : points ) { list . add ( point . toDBObject ( ) ) ; } return new BasicDBObject ( geometry , list ) ; }
Creates a DBObject from this Shape
26,884
public FindOptions modifier ( final String key , final Object value ) { options . getModifiers ( ) . put ( key , value ) ; return this ; }
Adds a modifier to the find operation
26,885
@ SuppressWarnings ( "unchecked" ) public void setOps ( final DBObject ops ) { this . ops = ( Map < String , Map < String , Object > > ) ops ; }
Sets the operations for this UpdateOpsImpl
26,886
@ SuppressWarnings ( "unchecked" ) public static < T > T unwrap ( final T entity ) { if ( isProxy ( entity ) ) { return ( T ) asProxy ( entity ) . __unwrap ( ) ; } return entity ; }
If proxied returns the unwrapped entity .
26,887
public static Class getReferentClass ( final Object entity ) { if ( isProxy ( entity ) ) { return asProxy ( entity ) . __getReferenceObjClass ( ) ; } else { return entity != null ? entity . getClass ( ) : null ; } }
Returns the class backing this entity
26,888
public static boolean isFetched ( final Object entity ) { return entity == null || ! isProxy ( entity ) || asProxy ( entity ) . __isFetched ( ) ; }
Checks if the proxied entity has been fetched .
26,889
public CountOptions maxTime ( final long maxTime , final TimeUnit timeUnit ) { notNull ( "timeUnit" , timeUnit ) ; options . maxTime ( maxTime , timeUnit ) ; return this ; }
Sets the maximum execution time on the server for this operation .
26,890
public void addAnnotation ( final Class < ? extends Annotation > clazz , final Annotation ann ) { if ( ann == null || clazz == null ) { return ; } if ( ! foundAnnotations . containsKey ( clazz ) ) { foundAnnotations . put ( clazz , new ArrayList < Annotation > ( ) ) ; } foundAnnotations . get ( clazz ) . add ( ann ) ; }
Adds the given Annotation to the internal list for the given Class .
26,891
@ SuppressWarnings ( { "WMI" , "unchecked" } ) public DBObject callLifecycleMethods ( final Class < ? extends Annotation > event , final Object entity , final DBObject dbObj , final Mapper mapper ) { final List < ClassMethodPair > methodPairs = getLifecycleMethods ( ( Class < Annotation > ) event ) ; DBObject retDbObj = dbObj ; try { Object tempObj ; if ( methodPairs != null ) { final HashMap < Class < ? > , Object > toCall = new HashMap < Class < ? > , Object > ( ( int ) ( methodPairs . size ( ) * 1.3 ) ) ; for ( final ClassMethodPair cm : methodPairs ) { toCall . put ( cm . clazz , null ) ; } for ( final Class < ? > c : toCall . keySet ( ) ) { if ( c != null ) { toCall . put ( c , getOrCreateInstance ( c , mapper ) ) ; } } for ( final ClassMethodPair cm : methodPairs ) { final Method method = cm . method ; final Object inst = toCall . get ( cm . clazz ) ; method . setAccessible ( true ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( format ( "Calling lifecycle method(@%s %s) on %s" , event . getSimpleName ( ) , method , inst ) ) ; } if ( inst == null ) { if ( method . getParameterTypes ( ) . length == 0 ) { tempObj = method . invoke ( entity ) ; } else { tempObj = method . invoke ( entity , retDbObj ) ; } } else if ( method . getParameterTypes ( ) . length == 0 ) { tempObj = method . invoke ( inst ) ; } else if ( method . getParameterTypes ( ) . length == 1 ) { tempObj = method . invoke ( inst , entity ) ; } else { tempObj = method . invoke ( inst , entity , retDbObj ) ; } if ( tempObj != null ) { retDbObj = ( DBObject ) tempObj ; } } } callGlobalInterceptors ( event , entity , dbObj , mapper ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; } return retDbObj ; }
Call the lifecycle methods
26,892
public Annotation getAnnotation ( final Class < ? extends Annotation > clazz ) { final List < Annotation > found = foundAnnotations . get ( clazz ) ; return found == null || found . isEmpty ( ) ? null : found . get ( found . size ( ) - 1 ) ; }
Looks for an annotation of the type given
26,893
@ SuppressWarnings ( "unchecked" ) public < T > List < T > getAnnotations ( final Class < ? extends Annotation > clazz ) { return ( List < T > ) foundAnnotations . get ( clazz ) ; }
Looks for an annotation in the annotations found on a class while mapping
26,894
public List < MappedField > getFieldsAnnotatedWith ( final Class < ? extends Annotation > clazz ) { final List < MappedField > results = new ArrayList < MappedField > ( ) ; for ( final MappedField mf : persistenceFields ) { if ( mf . hasAnnotation ( clazz ) ) { results . add ( mf ) ; } } return results ; }
Returns fields annotated with the clazz
26,895
public Annotation getFirstAnnotation ( final Class < ? extends Annotation > clazz ) { final List < Annotation > found = foundAnnotations . get ( clazz ) ; return found == null || found . isEmpty ( ) ? null : found . get ( 0 ) ; }
Returns the first found Annotation or null .
26,896
public MappedField getMappedField ( final String storedName ) { for ( final MappedField mf : persistenceFields ) { for ( final String n : mf . getLoadNames ( ) ) { if ( storedName . equals ( n ) ) { return mf ; } } } return null ; }
Returns the MappedField by the name that it will stored in mongodb as
26,897
public MappedField getMappedFieldByJavaField ( final String name ) { for ( final MappedField mf : persistenceFields ) { if ( name . equals ( mf . getJavaFieldName ( ) ) ) { return mf ; } } return null ; }
Returns MappedField for a given java field name on the this MappedClass
26,898
@ SuppressWarnings ( "deprecation" ) public void validate ( final Mapper mapper ) { new MappingValidator ( mapper . getOptions ( ) . getObjectFactory ( ) ) . validate ( mapper , this ) ; }
Validates this MappedClass
26,899
public boolean apply ( final Class < ? > type , final Object value , final List < ValidationFailure > validationFailures ) { if ( getRequiredValueType ( ) . isAssignableFrom ( value . getClass ( ) ) ) { validate ( type , value , validationFailures ) ; return true ; } return false ; }
Applied validation for the given field . If the value does not match the correct type the validation is not applied and this method returns false . If the value is to be validated then the validate method is called to see if the value and type are compatible . Errors are appended to the validationFailures list .