idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
33,000 | public void extract ( final InputStream inputStream , final Metadata metadata ) throws IOException { RandomAccessStreamReader reader = new RandomAccessStreamReader ( inputStream ) ; EpsDirectory directory = new EpsDirectory ( ) ; metadata . addDirectory ( directory ) ; switch ( reader . getInt32 ( 0 ) ) { case 0xC5D0D3... | Filter method that determines if file will contain an EPS Header . If it does it will read the necessary data and then set the position to the beginning of the PostScript data . If it does not the position will not be changed . After both scenarios the main extract method is called . |
33,001 | private void addToDirectory ( final EpsDirectory directory , String name , String value ) throws IOException { Integer tag = EpsDirectory . _tagIntegerMap . get ( name ) ; if ( tag == null ) return ; switch ( tag ) { case EpsDirectory . TAG_IMAGE_DATA : extractImageData ( directory , value ) ; break ; case EpsDirectory... | Default case that adds comment with keyword to directory |
33,002 | private static int tryHexToInt ( byte b ) { if ( b >= '0' && b <= '9' ) return b - '0' ; if ( b >= 'A' && b <= 'F' ) return b - 'A' + 10 ; if ( b >= 'a' && b <= 'f' ) return b - 'a' + 10 ; return - 1 ; } | Treats a byte as an ASCII character and returns it s numerical value in hexadecimal . If conversion is not possible returns - 1 . |
33,003 | public GeoLocation getGeoLocation ( ) { Rational [ ] latitudes = getRationalArray ( TAG_LATITUDE ) ; Rational [ ] longitudes = getRationalArray ( TAG_LONGITUDE ) ; String latitudeRef = getString ( TAG_LATITUDE_REF ) ; String longitudeRef = getString ( TAG_LONGITUDE_REF ) ; if ( latitudes == null || latitudes . length !... | Parses various tags in an attempt to obtain a single object representing the latitude and longitude at which this image was captured . |
33,004 | public Date getGpsDate ( ) { String date = getString ( TAG_DATE_STAMP ) ; Rational [ ] timeComponents = getRationalArray ( TAG_TIME_STAMP ) ; if ( date == null ) return null ; if ( timeComponents == null || timeComponents . length != 3 ) return null ; String dateTime = String . format ( Locale . US , "%s %02d:%02d:%02.... | Parses the date stamp tag and the time stamp tag to obtain a single Date object representing the date and time when this image was captured . |
33,005 | public boolean getBit ( int index ) throws IOException { int byteIndex = index / 8 ; int bitIndex = index % 8 ; validateIndex ( byteIndex , 1 ) ; byte b = getByte ( byteIndex ) ; return ( ( b >> bitIndex ) & 1 ) == 1 ; } | Gets whether a bit at a specific index is set or not . |
33,006 | public int getUInt16 ( int index ) throws IOException { validateIndex ( index , 2 ) ; if ( _isMotorolaByteOrder ) { return ( getByte ( index ) << 8 & 0xFF00 ) | ( getByte ( index + 1 ) & 0xFF ) ; } else { return ( getByte ( index + 1 ) << 8 & 0xFF00 ) | ( getByte ( index ) & 0xFF ) ; } } | Returns an unsigned 16 - bit int calculated from two bytes of data at the specified index . |
33,007 | public int getInt24 ( int index ) throws IOException { validateIndex ( index , 3 ) ; if ( _isMotorolaByteOrder ) { return ( ( ( int ) getByte ( index ) ) << 16 & 0xFF0000 ) | ( ( ( int ) getByte ( index + 1 ) ) << 8 & 0xFF00 ) | ( ( ( int ) getByte ( index + 2 ) ) & 0xFF ) ; } else { return ( ( ( int ) getByte ( index ... | Get a 24 - bit unsigned integer from the buffer returning it as an int . |
33,008 | public int getInt32 ( int index ) throws IOException { validateIndex ( index , 4 ) ; if ( _isMotorolaByteOrder ) { return ( getByte ( index ) << 24 & 0xFF000000 ) | ( getByte ( index + 1 ) << 16 & 0xFF0000 ) | ( getByte ( index + 2 ) << 8 & 0xFF00 ) | ( getByte ( index + 3 ) & 0xFF ) ; } else { return ( getByte ( index... | Returns a signed 32 - bit integer from four bytes of data at the specified index the buffer . |
33,009 | protected String getEncodedTextDescription ( int tagType ) { byte [ ] commentBytes = _directory . getByteArray ( tagType ) ; if ( commentBytes == null ) return null ; if ( commentBytes . length == 0 ) return "" ; final Map < String , String > encodingMap = new HashMap < String , String > ( ) ; encodingMap . put ( "ASCI... | EXIF UserComment GPSProcessingMethod and GPSAreaInformation |
33,010 | public int getInt32 ( ) throws IOException { if ( _isMotorolaByteOrder ) { return ( getByte ( ) << 24 & 0xFF000000 ) | ( getByte ( ) << 16 & 0xFF0000 ) | ( getByte ( ) << 8 & 0xFF00 ) | ( getByte ( ) & 0xFF ) ; } else { return ( getByte ( ) & 0xFF ) | ( getByte ( ) << 8 & 0xFF00 ) | ( getByte ( ) << 16 & 0xFF0000 ) | (... | Returns a signed 32 - bit integer from four bytes of data . |
33,011 | void draw ( Canvas canvas ) { mCanvasRect . set ( 0.0f , 0.0f , canvas . getWidth ( ) , canvas . getHeight ( ) ) ; switch ( mShape ) { case SHAPE_RECTANGLE : canvas . drawRect ( mCanvasRect , mCanvasPaint ) ; break ; case SHAPE_OVAL : canvas . drawOval ( mCanvasRect , mCanvasPaint ) ; break ; case SHAPE_STAR_3_VERTICES... | draw s specified shape |
33,012 | private void refreshMargin ( ) { if ( isWeakReferenceValid ( ) ) { ViewGroup . MarginLayoutParams layoutParams = ( ViewGroup . MarginLayoutParams ) getTextView ( ) . get ( ) . getLayoutParams ( ) ; layoutParams . bottomMargin = mEdgeMarginInPx ; layoutParams . topMargin = mEdgeMarginInPx ; layoutParams . rightMargin = ... | refresh s margin if set |
33,013 | private void refreshDrawable ( ) { if ( isWeakReferenceValid ( ) ) { TextView textView = getTextView ( ) . get ( ) ; textView . setBackgroundDrawable ( getBadgeDrawable ( textView . getContext ( ) ) ) ; } } | refresh s background drawable |
33,014 | private void setTextColor ( ) { if ( isWeakReferenceValid ( ) ) { TextView textView = getTextView ( ) . get ( ) ; textView . setTextColor ( getTextColor ( textView . getContext ( ) ) ) ; } } | set s new text color |
33,015 | void bindToBottomTab ( BottomNavigationTab bottomNavigationTab ) { bottomNavigationTab . badgeView . clearPrevious ( ) ; if ( bottomNavigationTab . badgeItem != null ) { bottomNavigationTab . badgeItem . setTextView ( null ) ; } bottomNavigationTab . setBadgeItem ( this ) ; setTextView ( bottomNavigationTab . badgeView... | binds all badgeItem BottomNavigationTab and BadgeTextView |
33,016 | public static int fetchContextColor ( Context context , int androidAttribute ) { TypedValue typedValue = new TypedValue ( ) ; TypedArray a = context . obtainStyledAttributes ( typedValue . data , new int [ ] { androidAttribute } ) ; int color = a . getColor ( 0 , 0 ) ; a . recycle ( ) ; return color ; } | This method can be extended to get all android attributes color string dimension ... etc |
33,017 | private void parseAttrs ( Context context , AttributeSet attrs ) { if ( attrs != null ) { TypedArray typedArray = context . getTheme ( ) . obtainStyledAttributes ( attrs , R . styleable . BottomNavigationBar , 0 , 0 ) ; mActiveColor = typedArray . getColor ( R . styleable . BottomNavigationBar_bnbActiveColor , Utils . ... | This method initiates the bottomNavigationBar properties Tries to get them form XML if not preset sets them to their default values . |
33,018 | private void init ( ) { setLayoutParams ( new ViewGroup . LayoutParams ( new ViewGroup . LayoutParams ( ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ) ; LayoutInflater inflater = LayoutInflater . from ( getContext ( ) ) ; View parentView = inflater . inflate ( R . layout . botto... | This method initiates the bottomNavigationBar and handles layout related values |
33,019 | public void initialise ( ) { mSelectedPosition = DEFAULT_SELECTED_POSITION ; mBottomNavigationTabs . clear ( ) ; if ( ! mBottomNavigationItems . isEmpty ( ) ) { mTabContainer . removeAllViews ( ) ; if ( mMode == MODE_DEFAULT ) { if ( mBottomNavigationItems . size ( ) <= MIN_SIZE ) { mMode = MODE_FIXED ; } else { mMode ... | This method should be called at the end of all customisation method . This method will take all changes in to consideration and redraws tabs . |
33,020 | public void clearAll ( ) { mTabContainer . removeAllViews ( ) ; mBottomNavigationTabs . clear ( ) ; mBottomNavigationItems . clear ( ) ; mBackgroundOverlay . setVisibility ( View . GONE ) ; mContainer . setBackgroundColor ( Color . TRANSPARENT ) ; mSelectedPosition = DEFAULT_SELECTED_POSITION ; } | Clears all stored data and this helps to re - initialise tabs from scratch |
33,021 | private void setUpTab ( boolean isNoTitleMode , BottomNavigationTab bottomNavigationTab , BottomNavigationItem currentItem , int itemWidth , int itemActiveWidth ) { bottomNavigationTab . setIsNoTitleMode ( isNoTitleMode ) ; bottomNavigationTab . setInactiveWidth ( itemWidth ) ; bottomNavigationTab . setActiveWidth ( it... | Internal method to setup tabs |
33,022 | private void selectTabInternal ( int newPosition , boolean firstTab , boolean callListener , boolean forcedSelection ) { int oldPosition = mSelectedPosition ; if ( mSelectedPosition != newPosition ) { if ( mBackgroundStyle == BACKGROUND_STYLE_STATIC ) { if ( mSelectedPosition != - 1 ) mBottomNavigationTabs . get ( mSel... | Internal Method to select a tab |
33,023 | private void sendListenerCall ( int oldPosition , int newPosition , boolean forcedSelection ) { if ( mTabSelectedListener != null ) { if ( forcedSelection ) { mTabSelectedListener . onTabSelected ( newPosition ) ; } else { if ( oldPosition == newPosition ) { mTabSelectedListener . onTabReselected ( newPosition ) ; } el... | Internal method used to send callbacks to listener |
33,024 | void setDimens ( int width , int height ) { mAreDimensOverridden = true ; mDesiredWidth = width ; mDesiredHeight = height ; requestLayout ( ) ; } | if width and height of the view needs to be changed |
33,025 | static int [ ] getMeasurementsForFixedMode ( Context context , int screenWidth , int noOfTabs , boolean scrollable ) { int [ ] result = new int [ 2 ] ; int minWidth = ( int ) context . getResources ( ) . getDimension ( R . dimen . fixed_min_width_small_views ) ; int maxWidth = ( int ) context . getResources ( ) . getDi... | Used to get Measurements for MODE_FIXED |
33,026 | static int [ ] getMeasurementsForShiftingMode ( Context context , int screenWidth , int noOfTabs , boolean scrollable ) { int [ ] result = new int [ 2 ] ; int minWidth = ( int ) context . getResources ( ) . getDimension ( R . dimen . shifting_min_width_inactive ) ; int maxWidth = ( int ) context . getResources ( ) . ge... | Used to get Measurements for MODE_SHIFTING |
33,027 | static void bindTabWithData ( BottomNavigationItem bottomNavigationItem , BottomNavigationTab bottomNavigationTab , BottomNavigationBar bottomNavigationBar ) { Context context = bottomNavigationBar . getContext ( ) ; bottomNavigationTab . setLabel ( bottomNavigationItem . getTitle ( context ) ) ; bottomNavigationTab . ... | Used to get set data to the Tab views from navigation items |
33,028 | static void setBackgroundWithRipple ( View clickedView , final View backgroundView , final View bgOverlay , final int newColor , int animationDuration ) { int centerX = ( int ) ( clickedView . getX ( ) + ( clickedView . getMeasuredWidth ( ) / 2 ) ) ; int centerY = clickedView . getMeasuredHeight ( ) / 2 ; int finalRadi... | Used to set the ripple animation when a tab is selected |
33,029 | public Iterable < ? extends File > getClassPath ( File root , Iterable < ? extends File > classPath ) { return this . classPath == null ? new PrefixIterable ( root , classPath ) : this . classPath ; } | Returns the class path or builds a class path from the supplied arguments if no class path was set . |
33,030 | private List < TypeDescription > filterRelevant ( TypeDescription typeDescription ) { List < TypeDescription > filtered = new ArrayList < TypeDescription > ( prioritizedInterfaces . size ( ) ) ; Set < TypeDescription > relevant = new HashSet < TypeDescription > ( typeDescription . getInterfaces ( ) . asErasures ( ) ) ;... | Filters the relevant prioritized interfaces for a given type i . e . finds the types that are directly declared on a given instrumented type . |
33,031 | public static < T extends FieldDescription > ElementMatcher . Junction < T > definedField ( ElementMatcher < ? super FieldDescription . InDefinedShape > matcher ) { return new DefinedShapeMatcher < T , FieldDescription . InDefinedShape > ( matcher ) ; } | Matches a field in its defined shape . |
33,032 | public static < T extends MethodDescription > ElementMatcher . Junction < T > definedMethod ( ElementMatcher < ? super MethodDescription . InDefinedShape > matcher ) { return new DefinedShapeMatcher < T , MethodDescription . InDefinedShape > ( matcher ) ; } | Matches a method in its defined shape . |
33,033 | public static < T extends ParameterDescription > ElementMatcher . Junction < T > definedParameter ( ElementMatcher < ? super ParameterDescription . InDefinedShape > matcher ) { return new DefinedShapeMatcher < T , ParameterDescription . InDefinedShape > ( matcher ) ; } | Matches a parameter in its defined shape . |
33,034 | public static < T extends ParameterDescription > ElementMatcher . Junction < T > hasType ( ElementMatcher < ? super TypeDescription > matcher ) { return hasGenericType ( erasure ( matcher ) ) ; } | Matches a parameter s type by the given matcher . |
33,035 | public static < T extends ParameterDescription > ElementMatcher . Junction < T > hasGenericType ( ElementMatcher < ? super TypeDescription . Generic > matcher ) { return new MethodParameterTypeMatcher < T > ( matcher ) ; } | Matches a method parameter by its generic type . |
33,036 | public static < T > ElementMatcher . Junction < T > not ( ElementMatcher < ? super T > matcher ) { return new NegatingMatcher < T > ( matcher ) ; } | Inverts another matcher . |
33,037 | public static < T > ElementMatcher . Junction < Iterable < ? extends T > > whereAny ( ElementMatcher < ? super T > matcher ) { return new CollectionItemMatcher < T > ( matcher ) ; } | Matches an iterable by assuring that at least one element of the iterable collection matches the provided matcher . |
33,038 | public static < T > ElementMatcher . Junction < Iterable < ? extends T > > whereNone ( ElementMatcher < ? super T > matcher ) { return not ( whereAny ( matcher ) ) ; } | Matches an iterable by assuring that no element of the iterable collection matches the provided matcher . |
33,039 | public static < T extends TypeDescription . Generic > ElementMatcher . Junction < T > erasure ( Class < ? > type ) { return erasure ( is ( type ) ) ; } | Matches a generic type s erasure against the provided type . As a wildcard does not define an erasure a runtime exception is thrown when this matcher is applied to a wildcard . |
33,040 | public static < T extends TypeDescription . Generic > ElementMatcher . Junction < T > erasure ( ElementMatcher < ? super TypeDescription > matcher ) { return new ErasureMatcher < T > ( matcher ) ; } | Converts a matcher for a type description into a matcher for the matched type s erasure . As a wildcard does not define an erasure a runtime exception is thrown when this matcher is applied to a wildcard . |
33,041 | public static < T extends Iterable < ? extends TypeDescription . Generic > > ElementMatcher . Junction < T > erasures ( ElementMatcher < ? super Iterable < ? extends TypeDescription > > matcher ) { return new CollectionErasureMatcher < T > ( matcher ) ; } | Applies the provided matchers to an iteration og generic types erasures . As a wildcard does not define an erasure a runtime exception is thrown when this matcher is applied to a wildcard . |
33,042 | public static < T extends MethodDescription > ElementMatcher . Junction < T > returns ( ElementMatcher < ? super TypeDescription > matcher ) { return returnsGeneric ( erasure ( matcher ) ) ; } | Matches a method s return type s erasure by the given matcher . |
33,043 | public static < T extends MethodDescription > ElementMatcher . Junction < T > declaresGenericException ( ElementMatcher < ? super Iterable < ? extends TypeDescription . Generic > > matcher ) { return new MethodExceptionTypeMatcher < T > ( matcher ) ; } | Matches a method s generic exception types against the provided matcher . |
33,044 | public static < T extends MethodDescription > ElementMatcher . Junction < T > isVirtual ( ) { return new MethodSortMatcher < T > ( MethodSortMatcher . Sort . VIRTUAL ) ; } | Matches any method that is virtual i . e . non - constructors that are non - static and non - private . |
33,045 | public static < T extends MethodDescription > ElementMatcher . Junction < T > isDefaultMethod ( ) { return new MethodSortMatcher < T > ( MethodSortMatcher . Sort . DEFAULT_METHOD ) ; } | Only matches Java 8 default methods . |
33,046 | public static < T extends MethodDescription > ElementMatcher . Junction < T > isSetter ( ) { return nameStartsWith ( "set" ) . and ( takesArguments ( 1 ) ) . and ( returns ( TypeDescription . VOID ) ) ; } | Matches any Java bean setter method . |
33,047 | public static < T extends MethodDescription > ElementMatcher . Junction < T > isGetter ( ) { return takesArguments ( 0 ) . and ( not ( returns ( TypeDescription . VOID ) ) ) . and ( nameStartsWith ( "get" ) . or ( nameStartsWith ( "is" ) . and ( returnsGeneric ( anyOf ( boolean . class , Boolean . class ) ) ) ) ) ; } | Matches any Java bean getter method . |
33,048 | public static < T extends MethodDescription > ElementMatcher . Junction < T > hasMethodName ( String internalName ) { if ( MethodDescription . CONSTRUCTOR_INTERNAL_NAME . equals ( internalName ) ) { return isConstructor ( ) ; } else if ( MethodDescription . TYPE_INITIALIZER_INTERNAL_NAME . equals ( internalName ) ) { r... | Matches a method against its internal name such that constructors and type initializers are matched appropriately . |
33,049 | public static < T extends MethodDescription > ElementMatcher . Junction < T > hasSignature ( MethodDescription . SignatureToken token ) { return new SignatureTokenMatcher < T > ( is ( token ) ) ; } | Only matches method descriptions that yield the provided signature token . |
33,050 | public static < T extends TypeDescription > ElementMatcher . Junction < T > isSubTypeOf ( TypeDescription type ) { return new SubTypeMatcher < T > ( type ) ; } | Matches any type description that is a subtype of the given type . |
33,051 | public static < T extends TypeDescription > ElementMatcher . Junction < T > inheritsAnnotation ( TypeDescription type ) { return inheritsAnnotation ( is ( type ) ) ; } | Matches any annotations by their type on a type that declared these annotations or inherited them from its super classes . |
33,052 | public static < T extends TypeDescription > ElementMatcher . Junction < T > inheritsAnnotation ( ElementMatcher < ? super TypeDescription > matcher ) { return hasAnnotation ( annotationType ( matcher ) ) ; } | Matches any annotations by a given matcher on a type that declared these annotations or inherited them from its super classes . |
33,053 | public static < T extends TypeDescription > ElementMatcher . Junction < T > hasAnnotation ( ElementMatcher < ? super AnnotationDescription > matcher ) { return new InheritedAnnotationMatcher < T > ( new CollectionItemMatcher < AnnotationDescription > ( matcher ) ) ; } | Matches a list of annotations by a given matcher on a type that declared these annotations or inherited them from its super classes . |
33,054 | public static < T extends TypeDefinition > ElementMatcher . Junction < T > declaresField ( ElementMatcher < ? super FieldDescription > matcher ) { return new DeclaringFieldMatcher < T > ( new CollectionItemMatcher < FieldDescription > ( matcher ) ) ; } | Matches a type by a another matcher that is applied on any of its declared fields . |
33,055 | public static < T extends TypeDefinition > ElementMatcher . Junction < T > declaresMethod ( ElementMatcher < ? super MethodDescription > matcher ) { return new DeclaringMethodMatcher < T > ( new CollectionItemMatcher < MethodDescription > ( matcher ) ) ; } | Matches a type by a another matcher that is applied on any of its declared methods . |
33,056 | public static < T extends AnnotationDescription > ElementMatcher . Junction < T > annotationType ( ElementMatcher < ? super TypeDescription > matcher ) { return new AnnotationTypeMatcher < T > ( matcher ) ; } | Matches if an annotation s type matches the supplied matcher . |
33,057 | public static < T extends ClassLoader > ElementMatcher . Junction < T > isChildOf ( ClassLoader classLoader ) { return classLoader == BOOTSTRAP_CLASSLOADER ? new BooleanMatcher < T > ( true ) : ElementMatchers . < T > hasChild ( is ( classLoader ) ) ; } | Matches any class loader that is either the given class loader or a child of the given class loader . |
33,058 | public static < T extends ClassLoader > ElementMatcher . Junction < T > hasChild ( ElementMatcher < ? super ClassLoader > matcher ) { return new ClassLoaderHierarchyMatcher < T > ( matcher ) ; } | Matches all class loaders in the hierarchy of the matched class loader against a given matcher . |
33,059 | public static < T extends ClassLoader > ElementMatcher . Junction < T > isParentOf ( ClassLoader classLoader ) { return classLoader == BOOTSTRAP_CLASSLOADER ? ElementMatchers . < T > isBootstrapClassLoader ( ) : new ClassLoaderParentMatcher < T > ( classLoader ) ; } | Matches any class loader that is either the given class loader or a parent of the given class loader . |
33,060 | public static < T extends ClassLoader > ElementMatcher . Junction < T > ofType ( ElementMatcher < ? super TypeDescription > matcher ) { return new InstanceTypeMatcher < T > ( matcher ) ; } | Matches a class loader s type unless it is the bootstrap class loader which is never matched . |
33,061 | private static String findJavaVersionString ( MavenProject project ) { while ( project != null ) { String target = project . getProperties ( ) . getProperty ( "maven.compiler.target" ) ; if ( target != null ) { return target ; } for ( org . apache . maven . model . Plugin plugin : CompoundList . of ( project . getBuild... | Makes a best effort of locating the configured Java target version . |
33,062 | private static LinkedHashMap < String , TypeDescription > extractFields ( MethodDescription methodDescription ) { LinkedHashMap < String , TypeDescription > typeDescriptions = new LinkedHashMap < String , TypeDescription > ( ) ; int currentIndex = 0 ; if ( ! methodDescription . isStatic ( ) ) { typeDescriptions . put (... | Creates a linked hash map of field names to their types where each field represents a parameter of the method . |
33,063 | public static TypeVariableToken of ( TypeDescription . Generic typeVariable , ElementMatcher < ? super TypeDescription > matcher ) { return new TypeVariableToken ( typeVariable . getSymbol ( ) , typeVariable . getUpperBounds ( ) . accept ( new TypeDescription . Generic . Visitor . Substitutor . ForDetachment ( matcher ... | Transforms a type variable into a type variable token with its bounds detached . |
33,064 | public static StackManipulation to ( TypeDefinition typeDefinition ) { if ( typeDefinition . isPrimitive ( ) ) { throw new IllegalArgumentException ( "Cannot cast to primitive type: " + typeDefinition ) ; } return new TypeCasting ( typeDefinition . asErasure ( ) ) ; } | Creates a casting to the given non - primitive type . |
33,065 | public void argument ( Closure < ? > closure ) { arguments . add ( ( PluginArgument ) project . configure ( new PluginArgument ( ) , closure ) ) ; } | Adds a plugin argument to consider during instantiation . |
33,066 | public List < Plugin . Factory . UsingReflection . ArgumentResolver > makeArgumentResolvers ( ) { if ( arguments == null ) { return Collections . emptyList ( ) ; } else { List < Plugin . Factory . UsingReflection . ArgumentResolver > argumentResolvers = new ArrayList < Plugin . Factory . UsingReflection . ArgumentResol... | Creates the argument resolvers for the plugin s constructor by transforming the plugin arguments . |
33,067 | public static StackManipulation of ( TypeDescription typeDescription ) { if ( typeDescription . isArray ( ) || typeDescription . isPrimitive ( ) || typeDescription . isAbstract ( ) ) { throw new IllegalArgumentException ( typeDescription + " is not instantiable" ) ; } return new TypeCreation ( typeDescription ) ; } | Creates a type creation for the given type . |
33,068 | public Object [ ] method ( Object arg1 , Object arg2 , Object arg3 ) { return new Object [ ] { arg1 , arg2 , arg3 } ; } | An example method . |
33,069 | private boolean matches ( MethodDescription target , List < ? extends TypeDefinition > typeDefinitions , Set < TypeDescription > duplicates ) { for ( TypeDefinition anInterface : typeDefinitions ) { if ( duplicates . add ( anInterface . asErasure ( ) ) && ( matches ( target , anInterface ) || matches ( target , anInter... | Matches a method against a list of types . |
33,070 | public static MethodHandle of ( MethodDescription . InDefinedShape methodDescription ) { return new MethodHandle ( HandleType . of ( methodDescription ) , methodDescription . getDeclaringType ( ) . asErasure ( ) , methodDescription . getInternalName ( ) , methodDescription . getReturnType ( ) . asErasure ( ) , methodDe... | Creates a method handle representation of the given method . |
33,071 | public static MethodHandle ofGetter ( FieldDescription . InDefinedShape fieldDescription ) { return new MethodHandle ( HandleType . ofGetter ( fieldDescription ) , fieldDescription . getDeclaringType ( ) . asErasure ( ) , fieldDescription . getInternalName ( ) , fieldDescription . getType ( ) . asErasure ( ) , Collecti... | Returns a method handle for a setter of the given field . |
33,072 | public static MethodHandle ofSetter ( FieldDescription . InDefinedShape fieldDescription ) { return new MethodHandle ( HandleType . ofSetter ( fieldDescription ) , fieldDescription . getDeclaringType ( ) . asErasure ( ) , fieldDescription . getInternalName ( ) , TypeDescription . VOID , Collections . singletonList ( fi... | Returns a method handle for a getter of the given field . |
33,073 | public String getDescriptor ( ) { StringBuilder stringBuilder = new StringBuilder ( ) . append ( '(' ) ; for ( TypeDescription parameterType : parameterTypes ) { stringBuilder . append ( parameterType . getDescriptor ( ) ) ; } return stringBuilder . append ( ')' ) . append ( returnType . getDescriptor ( ) ) . toString ... | Returns the method descriptor of this method handle representation . |
33,074 | public static JavaConstant ofVarHandle ( FieldDescription . InDefinedShape fieldDescription ) { return new Dynamic ( new ConstantDynamic ( fieldDescription . getInternalName ( ) , JavaType . VAR_HANDLE . getTypeStub ( ) . getDescriptor ( ) , new Handle ( Opcodes . H_INVOKESTATIC , CONSTANT_BOOTSTRAPS , fieldDescription... | Resolves a var handle constant for a field . |
33,075 | public static JavaConstant ofArrayVarHandle ( TypeDescription typeDescription ) { if ( ! typeDescription . isArray ( ) ) { throw new IllegalArgumentException ( "Not an array type: " + typeDescription ) ; } return new Dynamic ( new ConstantDynamic ( "arrayVarHandle" , JavaType . VAR_HANDLE . getTypeStub ( ) . getDescrip... | Resolves a var handle constant for an array . |
33,076 | public Class < ? > benchmarkJavassist ( ) { ProxyFactory proxyFactory = new ProxyFactory ( ) { protected ClassLoader getClassLoader ( ) { return newClassLoader ( ) ; } } ; proxyFactory . setUseCache ( false ) ; proxyFactory . setUseWriteReplace ( false ) ; proxyFactory . setSuperclass ( baseClass ) ; proxyFactory . set... | Performs a benchmark for a trivial class creation using javassist proxies . |
33,077 | public MemberRemoval stripFields ( ElementMatcher < ? super FieldDescription . InDefinedShape > matcher ) { return new MemberRemoval ( fieldMatcher . or ( matcher ) , methodMatcher ) ; } | Specifies that any field that matches the specified matcher should be removed . |
33,078 | public MemberRemoval stripInvokables ( ElementMatcher < ? super MethodDescription > matcher ) { return new MemberRemoval ( fieldMatcher , methodMatcher . or ( matcher ) ) ; } | Specifies that any method or constructor that matches the specified matcher should be removed . |
33,079 | @ SuppressFBWarnings ( value = "REC_CATCH_EXCEPTION" , justification = "Exception should not be rethrown but trigger a fallback" ) public static void main ( String [ ] args ) { try { String argument ; if ( args . length < 4 || args [ 3 ] . length ( ) == 0 ) { argument = null ; } else { StringBuilder stringBuilder = new... | Runs the attacher as a Java application . |
33,080 | protected static void install ( Class < ? > virtualMachineType , String processId , String agent , String argument ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException { Object virtualMachineInstance = virtualMachineType . getMethod ( ATTACH_METHOD_NAME , String . class ) . invoke ( STATI... | Installs a Java agent on a target VM . |
33,081 | public byte [ ] drain ( InputStream inputStream ) throws IOException { List < byte [ ] > previousBytes = new ArrayList < byte [ ] > ( ) ; byte [ ] currentArray = new byte [ bufferSize ] ; int currentIndex = 0 ; int currentRead ; do { currentRead = inputStream . read ( currentArray , currentIndex , bufferSize - currentI... | Drains an input stream into a byte array . The given input stream is not closed . |
33,082 | private static String nonAnonymous ( String typeName ) { int anonymousLoaderIndex = typeName . indexOf ( '/' ) ; return anonymousLoaderIndex == - 1 ? typeName : typeName . substring ( 0 , anonymousLoaderIndex ) ; } | Normalizes a type name if it is loaded by an anonymous class loader . |
33,083 | protected void onVisitFieldInsn ( int opcode , String owner , String name , String descriptor ) { super . visitFieldInsn ( opcode , owner , name , descriptor ) ; } | Visits a field instruction . |
33,084 | protected void onVisitTableSwitchInsn ( int minimum , int maximum , Label defaultTarget , Label ... label ) { super . visitTableSwitchInsn ( minimum , maximum , defaultTarget , label ) ; } | Visits a table switch instruction . |
33,085 | protected void onVisitLookupSwitchInsn ( Label defaultTarget , int [ ] key , Label [ ] label ) { super . visitLookupSwitchInsn ( defaultTarget , key , label ) ; } | Visits a lookup switch instruction . |
33,086 | protected String getGroupId ( String groupId ) { return this . groupId == null || this . groupId . length ( ) == 0 ? groupId : this . groupId ; } | Returns the group id to use . |
33,087 | protected String getArtifactId ( String artifactId ) { return this . artifactId == null || this . artifactId . length ( ) == 0 ? artifactId : this . artifactId ; } | Returns the artifact id to use . |
33,088 | public MavenCoordinate asCoordinate ( String groupId , String artifactId , String version , String packaging ) { return new MavenCoordinate ( getGroupId ( groupId ) , getArtifactId ( artifactId ) , getVersion ( version ) , getPackaging ( packaging ) ) ; } | Resolves this transformation to a Maven coordinate . |
33,089 | protected static LatentMatcher < MethodDescription > of ( LatentMatcher < ? super MethodDescription > ignoredMethods , TypeDescription originalType ) { ElementMatcher . Junction < MethodDescription > predefinedMethodSignatures = none ( ) ; for ( MethodDescription methodDescription : originalType . getDeclaredMethods ( ... | Creates a matcher where only overridable or declared methods are matched unless those are ignored . Methods that are declared by the target type are only matched if they are not ignored . Declared methods that are not found on the target type are always matched . |
33,090 | public ClassReloadingStrategy reset ( Class < ? > ... type ) throws IOException { return type . length == 0 ? this : reset ( ClassFileLocator . ForClassLoader . of ( type [ 0 ] . getClassLoader ( ) ) , type ) ; } | Resets all classes to their original definition while using the first type s class loader as a class file locator . |
33,091 | public ClassReloadingStrategy reset ( ClassFileLocator classFileLocator , Class < ? > ... type ) throws IOException { if ( type . length > 0 ) { try { strategy . reset ( instrumentation , classFileLocator , Arrays . asList ( type ) ) ; } catch ( ClassNotFoundException exception ) { throw new IllegalArgumentException ( ... | Resets all classes to their original definition . |
33,092 | public ClassReloadingStrategy enableBootstrapInjection ( File folder ) { return new ClassReloadingStrategy ( instrumentation , strategy , new BootstrapInjection . Enabled ( folder ) , preregisteredTypes ) ; } | Enables bootstrap injection for this class reloading strategy . |
33,093 | public ClassReloadingStrategy preregistered ( Class < ? > ... type ) { Map < String , Class < ? > > preregisteredTypes = new HashMap < String , Class < ? > > ( this . preregisteredTypes ) ; for ( Class < ? > aType : type ) { preregisteredTypes . put ( TypeDescription . ForLoadedType . getName ( aType ) , aType ) ; } re... | Registers a type to be explicitly available without explicit lookup . |
33,094 | private Implementation . SpecialMethodInvocation invokeConstructor ( MethodDescription . SignatureToken token ) { TypeDescription . Generic superClass = instrumentedType . getSuperClass ( ) ; MethodList < ? > candidates = superClass == null ? new MethodList . Empty < MethodDescription . InGenericShape > ( ) : superClas... | Resolves a special method invocation for a constructor invocation . |
33,095 | private Implementation . SpecialMethodInvocation invokeMethod ( MethodDescription . SignatureToken token ) { MethodGraph . Node methodNode = methodGraph . getSuperClassGraph ( ) . locate ( token ) ; return methodNode . getSort ( ) . isUnique ( ) ? Implementation . SpecialMethodInvocation . Simple . of ( methodNode . ge... | Resolves a special method invocation for a non - constructor invocation . |
33,096 | public static ClassFileVersion ofMinorMajor ( int versionNumber ) { ClassFileVersion classFileVersion = new ClassFileVersion ( versionNumber ) ; if ( classFileVersion . getMajorVersion ( ) <= BASE_VERSION ) { throw new IllegalArgumentException ( "Class version " + versionNumber + " is not valid" ) ; } return classFileV... | Creates a wrapper for a given minor - major release of the Java class file file . |
33,097 | public static ClassFileVersion ofJavaVersion ( int javaVersion ) { switch ( javaVersion ) { case 1 : return JAVA_V1 ; case 2 : return JAVA_V2 ; case 3 : return JAVA_V3 ; case 4 : return JAVA_V4 ; case 5 : return JAVA_V5 ; case 6 : return JAVA_V6 ; case 7 : return JAVA_V7 ; case 8 : return JAVA_V8 ; case 9 : return JAVA... | Creates a class file version for a given major release of Java . Currently all versions reaching from Java 1 to Java 9 are supported . |
33,098 | @ OperationsPerInvocation ( 20 ) public void baseline ( Blackhole blackHole ) { blackHole . consume ( baselineInstance . method ( booleanValue ) ) ; blackHole . consume ( baselineInstance . method ( byteValue ) ) ; blackHole . consume ( baselineInstance . method ( shortValue ) ) ; blackHole . consume ( baselineInstance... | Performs a benchmark for a casual class as a baseline . |
33,099 | @ OperationsPerInvocation ( 20 ) public void benchmarkJavassist ( Blackhole blackHole ) { blackHole . consume ( javassistInstance . method ( booleanValue ) ) ; blackHole . consume ( javassistInstance . method ( byteValue ) ) ; blackHole . consume ( javassistInstance . method ( shortValue ) ) ; blackHole . consume ( jav... | Performs a benchmark for a trivial class creation using javassist . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.